Ray Jette wrote:
> Bowie Bailey wrote:
> > 
> > \b matches a zero-length word boundary.  This means that one side
> > is a "word character" and the other side is not.  Word characters
> > are defined as alphanumeric plus "_".  So the only option in your
> > list that would cause a problem is "PO12345". 
> > 
> > Try this one:
> > 
> >     Subject =~ /\bPO(?:\b ?#?|\d)/i
> > 
> > Actually, since both the space and the hash are optional, is there
> > any point in matching them? 
> > 
> > This might be better:
> > 
> >     Subject =~ /\bPO(?:\b|\d)/i
> > 
> > Or you could look for the number (which removes the need for a word
> > boundary check): 
> > 
> >     Subject =~ /\bPO ?#? ?\d/i
> > 
> > 
> 
> A lot of these rules look good but not appear to work for what I am
> trying to do. Sorry about all the trouble. I'm not realy that good at
> regular expressions but I am learning. Here are some real examples
> from my mail server:
> 
>     * PO1786
>     * PO 42111
>     * PO# 314980
>     * PO#36605
>     * PO 484579-0
>     * PO:458121
>     * PO: 6718972-1
>     * PO's #47509
>     * PO#v156-2008-003
>     * PO-121556
>     * PO's 47509
> 
> Some of these are million's of dollers worth of orders. I can't loose
> these. I am trying to create a negative scoring rule. Thanks for any
> help you can provide. Please let me know if you need any more
> information. 

My second rule should work for any of these.  It simply looks for "PO"
followed by either a "non-word character" or a number.

Here is a more readable way to write it:

   Subject =~ /\bPO[\W\d]/i

I tested (using Perl) that this matches all of your examples above.  I
have not tested it as a SpamAssassin rule, but I can't think of any
reason why it would not work the same.

-- 
Bowie

Reply via email to