procmail
[Top] [All Lists]

Re: If VARIABLE = (this|orthis|orthat)

2001-11-29 13:22:32
When Sean suggested to Timothy,

| >| * REPLYTO ?? 
(\<|^)(joe(_at_)aol\(_dot_)com|ed(_at_)msn\(_dot_)com|john(_at_)yahoo\(_dot_)com)(\>|$)

I responded,

| >\< and \> already match newlines, so alternating them with ^ and $ is
| >unnecessary.

Sean has followed up,

| While it applies to the trailing newline, it DOES NOT with the leading
| anchor, since there is no _newline_ present at that end of the string
| (you're welcome to make a test script to demonstrate this to
| yourself).

Huh?

Newline is among the characters that \< will match.  Newline is also among
the characters that \> will match.  [In fact, \< and \> really mean exactly
the same thing in procmail regexps.]  Writing (\<|^) is redundant, like
writing ([a-z]|j).  The same goes for (\>|$).  That applies to every
newline, wherever it occurs: \< or \> will match it, just as ^ or $ will.
There is never a reason to use (\<|^) nor (\>|$) in a procmailrc regexp.
The above condition can be reduced to this:

 * REPLYTO ?? 
()\<(joe(_at_)aol\(_dot_)com|ed(_at_)msn\(_dot_)com|john(_at_)yahoo\(_dot_)com)\>

| since there is no _newline_ present at that end of the string

That's no longer true once it's been put into a variable and that variable
has been set as the search area, since every search area starts and ends
with a putative newline.   ^, \<, \>, $, and ^^ all can match a putative
newline [^^ specifically matches a putative newline and nothing else].


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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