Want to find a PCRE -P that finds expressions that do not contain a certain string of letters

Viewed 35

I have been trying to find a way to make an expression that looks through a word and if "abc" is in it it does not match

I have grep -P '^([^a]*(a([^b]|$)|ab([^c]|$))?)*$'

It passes all test cases except the following

if before the string there is a or ab before the abc instance an example would be "qqqababcqqq" FAILS another example would be "qqqqqaabc" FAILS

I am using a regex engine that does not support lookaround so I cannot use '!' I also want a way to find it in grep -P and am aware that it can easily be done in -v

here is the test case i am using:

01 lllllllllll
02 lllllaaaall
03 llllllllaaa
04 lllaablllll
05 lllllllllab
06 aaabbbcccll
07 llllabcllll
08 lllababclll
09 abc
10 llllaaabcll
11 llalabbllll
12 lllabllllabllllabaclll
13 lllabllllablllaabaclll
14 aaaawwwiiiwwwaaaaaa

the test case passes on all outputs besides case #10

0 Answers
Related