On Wednesday, June 19, 2013 10:40:49 PM UTC-5, kien wrote:
> On Thursday, June 20, 2013 10:07:59 AM UTC+7, Ben Fritz wrote:
> > On Wednesday, June 19, 2013 8:13:55 PM UTC-5, kien wrote:
> > > While `\v(&&|str)` (order reversed) works and doesn't cause the error.
> > > 
> > > Both expressions work with the old regexp engine.
> > 
> > While you shouldn't get an error message...I don't think that pattern is 
> > doing what you think unless you're just trying weird things to break the 
> > regex engine.
> > 
> > With very magic on, & by itself is the same as \& with regular magic. It 
> > looks like you're trying to match a literal string of two '&' characters. 
> > For that, if using \v, you need to escape it with a backslash. See :help 
> > /\&.
> 
> & didn't/doesn't need to be escaped. `\v(&&|str)` works without any error.
> 

What do you mean by "works"? What are you trying to match? For me, in this line 
of text:

one two three && four five six str seven eight

...the pattern matches EVERYWHERE.

This is because the match \v&& means "match wherever an empty string and 
another empty string match at the same location". This is between every single 
character in the line.

I assumed you wanted to match either the text "&&" or the text "str". If I 
escape the & characters as \&, this is exactly what I get.

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui