othree / eregex.vim

Perl/Ruby style regexp notation for Vim
http://www.vim.org/scripts/script.php?script_id=3282
214 stars 18 forks source link

Wrong syntax for backward non-match #5

Closed ghost closed 11 years ago

ghost commented 11 years ago

Wrong:

:1M/G(?<=O)
E486: Pattern not found: G\%(O\)\@<=

Correct:

\%(O\)\@<=G
othree commented 11 years ago

If you are looking for a ahead(right) zero-width match. You should use (?=pattern). 'G(?=O)' match:

GO
^

If you are looking behind(left) You should change the order of your pattern to (?<=O)G This match 'G' follows 'O'

OG
 ^

ref: perlre

ghost commented 11 years ago

:-O Thanks!