[ale] VI vs perl RE question

attriel attriel at d20boards.net
Wed Feb 1 22:27:01 EST 2006


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






More information about the Ale mailing list