Is it possible to do conditional regex (like the one described in http://www.regular-expressions.info/conditional.html) in Vim?
Vim regex does not have this feature, so you will need to use a bit of repetition to create the same behaviour:
/\(\%(condition\)\@=then\|\%(condition\)\@!else\)
Note that you have to use the condition twice in the Vim version and the lookahead/lookbehind must always be the opposite in the then/else parts otherwise your regex will not be correct.
Not natively, however if you have +perl in vim you should be able to use
:perldo s/search/replace/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With