I'm learning regex with lookaround (lookbehind and lookahead) feature but I cannot use .*
or .+
quantifiers in lookbehind (but I can on lookahead).
The regex I'm trying to fix is the following:
(?<!yellow.*)blue(?=.*brown)
The idea is to match lines that don't have yellow
but has blue
only if brown
exists after blue. Here are some samples:
yellow blue brown // shouldn't match
f blue brown // should match
sdff blue brown // should match
asdf f blue c // shouldn't match
yellow blue fblue b f brown // shouldn't match
Here is my test:
http://regex101.com/r/fY4kI9/5
The error I get is:
. * Lookbehinds need to be zero-width, thus quantifiers are not allowed
Do you know how I can fix that?