Don from deliberate.net asked about the difference between,
=> * LISTNAME ?? ^^(linux-kernel|bugtraq|procmail)^^
* LISTNAME ?? ^(linux-kernel|bugtraq|procmail)$
^^ represents the putative newline procmail imagines before the
beginning or after the end of the search area.
^ or $ represents either a real newline in the search area or one of
the putative ones around it.
The first requires a match to the entire content of $LISTNAME because it
is anchored to the putative newlines at both ends. The second requires
a match to any whole line in $LISTNAME.
If $LISTNAME contains no embedded newlines, that's equivalent. However,
using ^^, at least on the left, is possibly slight faster, because if
there's no match in the first line of the search area, procmail will
know not to bother looking ahead to see whether a later line matches or
In most regexp engines, ^ and $ represent a position at the beginning or
end of a line respectively; in procmail's they must have a character,
real or putative, to match to. That can be important sometimes.
In procmail's regexp engine, if there's no $-interpretation on the
regexp and the caret or dollar is not inside brackets, they're actually
interchangeable. You could write,
* LISTNAME ?? ()$(linux-kernel|bugtraq|procmail)^
and it would be exactly the same to procmail as the second condition up
top. But most other utilities that use regular expressions would
probably take the dollar and the caret as literal characters or consider
the expression a syntax error.
procmail mailing list