[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 20:30:54 -0700
- In-reply-to: <[email protected]>
- References: <[email protected]>
attriel wrote:
>>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.
>
>
Does + mean the same thing it does in grep/vi? That is, "one or more
of the preceding expression"? If so, it appears "?" can mean
different things depending on how it's used: in the first example, above,
it seems to mean "the previous thing is optional", whereas in
the second example, it seems to mean "don't be greedy".
?
-- JK