Reputation: 21
Conditions:
abc
AND include 123
456
My current regex is (abc$)(123)|456
but it doesn't work.
Upvotes: 0
Views: 50
Reputation: 626932
You can use
^(?=.*456).*123.*abc$
Details:
^
- start of string(?=.*456)
- a positive lookahead that requires any zero or more chars other than line break chars as many as possible, and then 456
immediately to the right of the current location.*
- any zero or more chars other than line break chars as many as possible123
- a literal value.*
- any zero or more chars other than line break chars as many as possibleabc
- an abc
string$
- end of string.Upvotes: 1