At 09:56 AM 1/23/2003, "Debbie D" wrote:
Is there any place I can find a tutorial on how to create rules?? I have
...
header FROM_ARMY             From =~ /*.army.mil/i
describe FROM_ARMY   From ARMY
which evidently was not to SA's liking because it stopped all testing past
that rule.
I can't think of any tutorials at the moment, but I can help you with this one. The =~ /.../ syntax means it's using Perl-style regular expressions, so what you really want is:

header FROM_ARMY From =~ /.*\.army\.mil/i

a "." matches any single character, and a "*" indicates repeating the previous match zero or more times. "\." means to match just a period. Of course, this rule won't match @army.mil, because it's looking for @.army.mil. So you may want something more like:

header FROM_ARMY From =~ /@(?:.+\.)?army\.mil/i
...which is the most precise and will match @army.mil or @bunchadomains.army.mil, or the simpler
header FROM_ARMY From =~ /.*army\.mil/i
... which has the disadvantage that it will also match, say, smarmy.mil (not that it's likely to exist.) Of course, both will match @army.millie.com, also an unlikely domain.

Notes:
? = match the previous character one or zero times
+ = match the previous character one or more times
* = match the previous character zero or more times
() = treat everything inside the parentheses as a lump and save the results
(?:) = same, but don't store the results (slightly more efficient if you don't need to save the info)

For more info, you can run "perldoc perlre



Kelson Vibber
SpeedGate Communications <www.speed.net>


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk


Reply via email to