[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] VI vs perl RE question
- Subject: [ale] VI vs perl RE question
- From: jknapka at kneuro.net (Joe Knapka)
- Date: Wed, 01 Feb 2006 09:12:10 -0700
- In-reply-to: <[email protected]>
- References: <[email protected]>
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".)
/".*"
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