procmail
[Top] [All Lists]

Re: Defining comments

1999-11-29 10:32:00
Martin Ward wrote,

| I think that the .* regexp is a "greedy" match, which will match
| as many characters as possible.

That depends on where you're using it.  In a procmailrc regexp, matching is
greedy only to the right of an extractor (the \/ that starts assignment to
MATCH).  It is stingy if there is no extractor in the regexp, or if the
wildcard is to the left of the extractor.

In other utilities, they're always greedy.

When there's no extractor in the regexp, it doesn't matter: if there are two
or more ways of matching the regexp in the search area, all we care about it
is that it matches at least once.  But to the left of an extractor its
parsimony [pun intended] can have highly unexpected results.

<Prev in Thread] Current Thread [Next in Thread>