Tuesday, September 18, 2012

Re: Why matchstr returns also text matched by zero-width pattern?

>
> > Yes, and @<= is what you wanted. You used @=, which is a zero-width look-ahead, not a look-behind.
>

Now I understand what you meant with "123 does not match where abc matches"! I misunderstood the whole look ahead concept. I find very useful this explanation:

http://stackoverflow.com/questions/2973436/regex-lookahead-lookbehind-and-atomic-groups


>
> Incidentally, I cannot recall ever having a use for \@=. As the help says, it does the same thing as \&.

I think lookaheads are good for defining more conditions which would be difficult to define in one expression. Like "four-letter world containing a vowel". Without lookaheads I think this could be done only with regex defined with four branches (each fixing a vowel on certain position).

Thank you for your patience :)

All the best

Martin



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: