Ray Jette wrote:
Bowie Bailey wrote:
Ray Jette wrote:
Bowie Bailey wrote:
Ray Jette wrote:

Good morning,
I am trying to write a negative scoring rule that files on the
following: PO PO#
PO #

Following is the rule I am using:

header PO_AND_ORDERS        Subject =~ /\bPO*?#?/i
score PO_AND_ORDERS        -0.50
describe PO_AND_ORDERS    A negative scoring rule that searches
the subject for PO #'s.
Thanks for any help you can provide.

Try this one:

    Subject =~ /\bPO\b ?#?/i

The "\b" after the "PO" will prevent it from matching things like
"positive", "pollen", or anything else that happens to start with
"po". Keep in mind that the "i" at the end makes it
case-insensitive, so this will match "PO", "po", "pO", etc.


Sometimes the subject will be: PO#34598459 so do I realy want to us
\b? I need to match all of the ollowing:
PO
PO#
PO  [0-9] - im not sure the max amount of numbers
PO#  [0-9] - im not sure the number of numbers
PO[0-9] - not sure how many numbers
PO#[0-9] - not sure how many numbers

\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.

Ray Jette




I am trying to write an expression to match above. I need to match the following
PO /\bPO
optional space /\bPO ?
Optional # /\bPO ?#?
Optional : /\bPO ?#?:?
Optional ' /\bPO ?#?:?'?
Optional s /\bPO ?#?:?'?s?
Optional space after # or : before numbers - /\bPO ?#?:?'?s? ?
Then I need numbers and letters - [0-9a-z]\{1,10\} - I may need need this.

Thank you very much. I have been working on this for over a week and still can't seem to get it. It is critical that I get this working.

Thaknks for any help you may provide.
Ray Jette
Network Engineer.

Reply via email to