On Tuesday, September 18, 2012 10:02:32 AM UTC-5, Ben Fritz wrote:
> On Monday, September 17, 2012 12:07:58 PM UTC-5, Martin Jiricka wrote:
>
> > Hello!
>
> >
>
> >
>
> >
>
> > First of all, thank you for your reply!
>
> >
>
> >
>
> >
>
> > > I think you wanted one of these:
>
> >
>
> > > \v(123)@<=abc
>
> >
>
> >
>
> >
>
> > Yes, this is what I wanted.
>
> >
>
> >
>
> >
>
> > > Additionally, if this WERE working as you expect, your pattern would NEVER
>
> >
>
> > > match. You are saying,
>
> >
>
> > > "match abc where 123 also matches in the same position"
>
> >
>
> > > which cannot possibly succeed, because 123 does not match where abc matches.
>
> >
>
> >
>
> >
>
> > I don't get this. Of course I didn't want to match 'abc' on '123'. (That's the purpose of regexes, match pattern where the pattern match, I would say...?) I posted simplified example, originally I wanted to match last word before the parenthesis, which is a function name. The '@<=' works fine for this.
>
> >
>
> >
>
>
>
> Yes, and @<= is what you wanted. You used @=, which is a zero-width look-ahead, not a look-behind.
>
>
>
> E.g. /\(abc\)\@=\a\+ will match the whole string "abcdefghij"; it says "find a string of alphabetic characters starting with 'abc'". /\(abc\)\@<=\a\+ will match the "defghij" in "abcdefghij" only; it says, "find a string of alphabetic characters preceded by 'abc'".
Incidentally, I cannot recall ever having a use for \@=. As the help says, it does the same thing as \&.
--
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
Tuesday, September 18, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment