procmail
[Top] [All Lists]

Re: Regular expression problem

2006-12-24 09:19:07
At 18:29 2006-12-23 -0800, Bart Schaefer wrote:

:0
* ^To:(.*\<)?\/[0-9]+@
* MATCH ?? ^^.......@
action

Explanation to OP:

The To: condition matches for one or more digits, and stores that in the 
$MATCH variable, then the second condition determines whether there are 
exactly 7 characters before the @ in that match string.  If both conditions 
are not met, the conditions of the rule is not true, and the action isn't 
performed.

While elegant considering the bulkiness of the alternative (esp as 'n' 
increases), this can run afoul if you're matching a field which has more 
than one entry.  To _usually_ doesn't, but it can, and other addressing 
fields such as Cc: most certainly will often have multiple addresses in 
them - whereas the regexp that captures the MATCH will match on the first 
qualifying string (which may not be 7 digits).

---
  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
  Please DO NOT carbon me on list replies.  I'll get my copy from the list.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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