You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by rj...@vzw.blackberry.net on 2009/01/21 02:04:20 UTC

Regular expression help

I am attempting to create a regular expression to give a negative score for purchase orders. I need to match the following:
PO
PO:
PO#
P.O.
P.O. #
PO #

I have not been able to get this to work correctly. I have the following:

/\bP\.?O\.?[:#]? [#]?/i

Any ideas?

Thanks in advance.

Ray

Re: Regular expression help

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Wed, 2009-01-21 at 01:04 +0000, rjette@vzw.blackberry.net wrote:
> I am attempting to create a regular expression to give a negative score
> for purchase orders.

> I have not been able to get this to work correctly. I have the following:

*flashback*

8 weeks passed. Did you read and understand all the replies? All the
custom rules people have been writing for you? Did you spend the time
learning REs as I told you, instead of blindly stabbing at the poor,
innocent stream of bytes?

Did you at least find out what mail "you are losing"? You never bothered
to respond to that at all...


Wow, that was one serious flashback.  I guess that's what I get for
losing myself in some old Seinfeld snippets. :)


-- 
char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}


Re: Regular expression help

Posted by Joseph Brennan <br...@columbia.edu>.

--On Wednesday, January 21, 2009 1:04 AM +0000 rjette@vzw.blackberry.net 
wrote:

> I am attempting to create a regular expression to give a negative score
> for purchase orders. I need to match the following:
> PO
> PO:
> PO#
> P.O.
> P.O. #
> PO #
>
> I have not been able to get this to work correctly. I have the following:
>
> /\bP\.?O\.?[:#]? [#]?/i
>


  /P\.?O/

Expect it to match things besides purchase orders, but they will be
false negatives.

Joseph Brennan




Re: Regular expression help

Posted by Matt Garretson <ma...@assembly.state.ny.us>.
John Hardin wrote:
> > On Wed, 21 Jan 2009, rjette@vzw.blackberry.net wrote:
> Didn't we already do this?


Hopefully it's just an old message that was stuck 
in a blackberry queue somewhere.  :)

 

Re: Regular expression help

Posted by John Hardin <jh...@impsec.org>.
On Wed, 21 Jan 2009, rjette@vzw.blackberry.net wrote:

> I am attempting to create a regular expression to give a negative score for purchase orders. I need to match the following:
> PO
> PO:
> PO#
> P.O.
> P.O. #
> PO #
>
> I have not been able to get this to work correctly. I have the following:
>
> /\bP\.?O\.?[:#]? [#]?/i
>
> Any ideas?

Didn't we already do this?

-- 
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
   Watch... Wallet... Gun... Knee...                    -- Denny Crane
-----------------------------------------------------------------------
  Tomorrow: John Moses Browning's 154th Birthday

Re: Regular expression help

Posted by wolfgang <me...@gmx.net>.
In an older episode (Wednesday, 21. January 2009), 
rjette@vzw.blackberry.net wrote:
> I am attempting to create a regular expression to give a negative
> score for purchase orders. I need to match the following: PO
> PO:
> PO#
> P.O.
> P.O. #
> PO #
>
> I have not been able to get this to work correctly. I have the
> following:
>
> /\bP\.?O\.?[:#]? [#]?/i

/\bP\.?O\.?[:#]? ?[#]?/i should work:
$ echo 'PO#'|perl -pe 's/\bP\.?O\.?[:#]? ?[#]?/blah/i'
blah

> Thanks in advance.

My pleasure.

wolfgang