Lance Brown asked,
| OK, I've searched through the procmail list archives and didn't find
| an answer and read the man page about this but am still not clear on
| the precise difference between the TO and TO_ tokens.
|
| Can someone provide a short description about how they are different
| and which is better?
The difference is that ^TO_ is pickier about the last character of the string
that it matches. For example, ^TO will match a string ending in a hyphen, so
^TOlistname will match "To: owner-listname" while ^TO_listname will not.
The idea is that the text after ^TO has to be found starting at the beginning
of a word, but the text after ^TO_ has to be found starting at the beginning
of an address. Per the procmailrc(5) man page:
If the regular expression contains `^TO_' it will be substi-
tuted by `(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope
|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)', which
should catch all destination specifications containing a
specific address.
If the regular expression contains `^TO' it will be substi-
tuted by `(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope
|Apparently(-Resent)?)-To):(.*[^a-zA-Z])?)', which should
catch all destination specifications containing a specific
word.
So with ^TOtext, "text" may appear right next to the colon, or if it is
farther along in the line, the last character left of "text" must not be
a letter of the alphabet. With ^TOtext, "text" may be immediately after
the colon or after a character that is not a letter, a digit, a hyphen,
an underscore, nor a period.