[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: attriel at d20boards.net (attriel)
- Date: Wed, 1 Feb 2006 22:27:01 -0500 (EST)
> In vi and [e]grep, "?" means "the preceding expression may or may not be
present". It
> Perl, it apparently means "don't be greedy", though it really surprises
me that such a
> fundamental piece of RE syntax would be different in Perl. So the ? in
the original
> (Perl) RE was not redundant; it accomplishes what [^"]* does in the
non-Perl case:
> stopping at the next quote encountered.
Actually
([a-z]+)? means some number of lowercase letters. Maybe.
([a-z]+?)fred means lowercase letters up to the first occurrence of "fred"
([a-z]+)fred looks for lowercase followed by fred, but not necessarily the
first fred.