A negative lookbehind assertion asserts true if the pattern inside the lookbehind is not matched.
Here is its syntax:
(?<!...)
For example, (?<!xyz)abc asserts that there cannot be the string, xyz, just before matching the string, abc.
Here are a few important points about lookaround regex patterns:
- Lookaround patterns are atomic. Like atomic groups, once a lookaround pattern is matched, the regex engine exits immediately from that lookaround, returning just a true or false assertion.
- Lookaround patterns don't move from the current position. All patterns are evaluated from the current position. The position remains the same after the lookaround assertions are completed.
- If a regular expression uses multiple lookaround ...