ferret icon indicating copy to clipboard operation
ferret copied to clipboard

Translate Perl-compatible patterns to Vim regular expression syntax

Open wincent opened this issue 8 years ago • 1 comments

:Ack can take fancy Perl-compatible regular expressions.

If you then run :Acks with the same pattern, Vim may not actually find anything, because its patterns are not Perl-compatible, even with the \v flag.

Doing 100% compatible translation would be impossible, as Perl regexen have features that Vim's do not, but we can handle the simple cases at least (eg. \bfoo\b could become <foo>, although we'd need to decide what to do with \bfoo).

wincent avatar Jul 17 '15 16:07 wincent

Maybe :perldo s/\bfoo\b/bar/gi can help most of the cases (if not all cases), as it supports the s/pattern/replacement/flags syntax used in Vim. Obviously, the only drawback is that the installation must have +perl or +perl/dyn.

EDIT: Also there is eregex. Didn't have time to use it, but looks like to be promising.

cpixl avatar Sep 30 '15 15:09 cpixl