On Mon, 22 Sep 2003, Brian Nesbit wrote:
I was trying to find some insight on how I can filter based on the
length of the From address. Specifically I want to filter anything with
a From address greater than 55 characters
The generic procmail way to test the length of a string is to store it in
a variable and then use the ?? and > or < operators:
:0
* VARIABLE ?? > 55
The procmail \/ operator in a regular expression is used to capture text
into the MATCH variable. So you want something like
:0
* ^From:\/.*
* MATCH ?? > 55
However, that's counting the entire From: line, not just the address part.
Extracting just an address can be tricky. You may be able to get away
with:
:0
* ^From:.*<?\/[^@<()]+(_at_)[^()>,]+
* MATCH ?? > 55
Whether that's sufficient depends on variations in the format of the From:
lines you process.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail