ferret
ferret copied to clipboard
Translate Perl-compatible patterns to Vim regular expression syntax
: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
).
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.