[ale] VI vs perl RE question
Geoffrey
esoteric at 3times25.net
Wed Feb 1 15:31:24 EST 2006
Joe Knapka wrote:
> Jim wrote:
>
>
>>I'm trying to use vi to search for something enclosed in quotes, using
>>perl RE I get a hit with $var =~/"(.*?)"/; But using the same re in vi
>>
>>
>
> So this is, "a quote, possibly followed by something, followed by
> another quote".
> (The question mark is redundant, since * already means "0 or more
> occurrences".)
I would expect that the ? says 'at least one character.'
>
> /".*"
>
> should work. But you probably really mean
>
> /"[^"]*"
>
> That is, a quote, possibly followed by non-quote stuff, followed by
> another quote.
> If you want to do the grouping you need to escape the parens (but not the
> brackets, which is weird IMO):
>
> /"\([^"]*\)"
>
> If you're doing it in a :s/// command, remember to specify which lines
> you want
> to search; eg
>
> :%s/"\([^"]*\)"/\1/gc
>
> to replace "X" with X throughout the document.
>
> -- JK
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>
--
Until later, Geoffrey
More information about the Ale
mailing list