Reputation: 883
I need a regular expression that matches the following conditions:
logger(textthatdoesnotcontain|)
Example:
logger(sample log) // Match
logger(sample log | test) // Not Match
I have tried below regex, but not working:
logger(?!*\|.*)
Upvotes: 0
Views: 40
Reputation: 149
logger\([^\|]+\)
should do the trick
Or if you want to match whole lines
^logger\([^\|]+\)$
This accept any character except "|" between "logger(" and ")"
Upvotes: 3
Reputation: 18357
If you want your line to not match if it contains |
, you can just use this regex,
^logger\([^|]*$
You don't need a negative look ahead when you want to fail the match just because of one character and can use negated character set for such use cases like this [^|]
Upvotes: 2