Monday, January 9, 2012

Re: Match string - quotes excluded

On Mon, Jan 9, 2012 at 5:38 PM, Fernando Basso
<fernandobasso.br@gmail.com> wrote:
> Say I have:
>
>    "a" more thext "b"
>
> Then, /"[^"]*" will find two separate strings. However, what if I want
> not to include the quotes? I have tried:
>
>    /"\zs[^"]*\ze"
>
> But it becomes too greey, and
.. I think greediness is not the culprit. You have specified [^"], so
it is not possible to do a greedy match... The issue is \ze, the match
stops early. So,
First match is:
a
Second is:
more thext
Third is:
b

Note that more thext is also surrounded by quotes.

If you do not want quotes to be considered as part of the match, it
should be for some reason - what is that?

>
>   /"\zs[^"]\{-}\ze"
>
> Doesn't work either.
>
> For matching multiple lines, it is not working either.
>
>    "\zs[^"]\_.\{-}\ze"
>
> What am I doing wrong?

--
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: