I have encountered many situations in vim where it would be useful to have lookaround statements.  I have tried using the standard lookaround syntax ((?=), (?!) etc ..), but it appears vim does not support this.  Does vim have an equivalent syntax for these kinds of statements?
Is lookaround possible in vim's regex system?
regular expression
Zoom anchorsIn addition to @jecxjo's answer, there are many situations where you can use the zero-width anchors \zs and \ze instead of positive lookaround. These anchors define the start (\zs) and the end (\ze) of the match within the full pattern.Examplesfoo\zsbar will match bar preceded by foo (foo not part of the match)foo\zebar will match foo followed by bar (bar not part of the match)myFunction(\zs.*\ze) will match the parameters in a function call (for demonstration purposes, I'm not focusing on greedy vs non-greedy matching)Putting it to useThese become most useful when using the :substitute command. For example, say I wanted to replace the parameters in a function call to myFunction() with foo::%s/myFunction(\zs.*\ze)/foo/This will leave myFunction( and ) intact, and you don't have to worry about capturing them in your pattern or repeating them in your replacement.You could do this using the lookaround feature of Vim's regex, but it's quite clunky: :%s/\(myFunction(\)\@<=.*\()\)\@=/foo/(I find this syntax causes me to forget what I was trying to do in the first place.)You still need lookaround sometimesThere are still situations where you need lookaround. Using \zs and \ze are great for simple situations where you have something before followed by text to match followed by something after. But if it's more complex than that, you'll probably have to stick to the heavier lookaround syntax.Fun factThough they're considerably uglier, Vim's lookarounds are more powerful than those in PCRE! They support variable-length negative lookbehind, meaning you can assert that some pattern whose length is not predetermined is not before your match.PCRE doesn't support this, as it's fairly computationally expensive. That's not a huge concern in Vim, since the most common use cases of regex tend to involve interactive searching where the computation time is nearly imperceptible to the user. You'd probably notice it if it were used for syntax highlighting, though.Relevant Help Topics:help \zs:help \ze:help perl-patterns