
Negative lookahead is indispensable if you want to match something not followed by something else. Lookaround allows you to create regular expressions that are impossible to create without them, or that would get very longwinded without them. They do not consume characters in the string, but only assert whether a match is possible or not. That is why they are called “assertions”. The difference is that lookaround actually matches characters, but then gives up the match, returning only the result: match or no match. Lookahead and lookbehind, collectively called “lookaround”, are zero-length assertions just like the start and end of line, and start and end of word anchors explained earlier in this tutorial. Lookahead and Lookbehind Zero-Length Assertions
