Regular Expressions
Lookahead/Lookbehind
?=
Positive Lookahead
Asserts that the contents of this group exists after the preceding portion of the regex, without being a part of the matched text. For example, given the text “dynamically negotiate multifunctional external sources”:
negotiate
: matches the word “negotiate”n(?=egotiate)
: matches “n”n(?=egotia)te
: matches nothingn(?=egotiate)egotiate
: matches the word “negotiate”
?!
Negative Lookahead
Asserts that the contents of this group does not exist after the preceding portion of the regex. For example, given the text “assertively deliver error-free niche delivery markets”:
deliver
: matches the word “deliver” and all but the last character of “delivery”deliver(?!y)
: only matches the word “deliver”
?<=
Positive Lookbehind
Asserts that the contents of this group exists before the subsequent portion of the regex, without being a part of the matched text. Semantics match positive lookahead.
?<!
Negative Lookbehind
Asserts that the contents of this group does not exist before the subsequent portion of the regex. Semantics match negative lookbehind.