0

I have to exclude a list of folders in a regular expression. Currently I am using a negative lookahead which works great:

enter image description here

Unfortunately, I'm on a system that has regex.h as the only regex library installed which does not support a lookahead (as far as I'm aware). Is it possible to do the above pattern without a lookahead? I may have an arbitrary number of folders so I don't believe the technique described in Regex: Matching by exclusion, without look-ahead - is it possible?. Is this possible to do without a lookahead? Or if not, I'll install something like pcre2 to do the above.

David542
  • 104,438
  • 178
  • 489
  • 842
  • 1
    You cannot match any string not containing a specific multichar sequence with a POSIX regex. Use `google_csv|exclude_me_too` and negate the result. Or install PCRE. – Wiktor Stribiżew Apr 23 '21 at 20:19
  • 1
    Why you don't try to match what you want to exclude and keep the remaining? In other words: *keep that if the pattern doesn't succeed.* It's very common to do that with a tool like grep for example. – Casimir et Hippolyte Apr 23 '21 at 22:10

0 Answers0