On Fri, 24 May 2002 the voices made Michael Moncur write: > > That's not equivalent. Note the placement of the carat WRT the first > > alternation in the original rule. It should be: > > > > /(?:^\s*|\s+)\[?(?:ADV|cc)[:\]]/i > > Wouldn't \b work as a substitute for the (?:^\s*|\s+)? or am I confused?
perldoc perlre<<'' A word boundary (`\b') is a spot between two characters that has a `\w' on one side of it and a `\W' on the other side of it (in either order), counting the imaginary char- acters off the beginning and end of the string as matching a `\W'. But... \b will work at the begining of the line although \W won't (I just did some testing to make sure). And since I'm wasting electrons anyways... why not something like (ignoring cc since I'm not familiar with it): /(^ADV(ert)?:|[[(]ADV:*\w*[])])/i ?! I think I've seen /^advert:/ used only once or twice, but it's a compromise for the /^adv\w*:/ that I'd really want to use ("word adv | egrep ^adv | wc" gave me 103 lines, nothing too common though); and the second part would mainly be catching the all too common porn-spam. In the spirit of the original /(^\s*|\s+)ADV:/i I guess it could simply be /(^\s*|\s+|[[(]ADV:/i; which in turn could be written as /^\s*ADV:|[[( ]ADV:/i, and somewhat extended it'd be /^\s*ADV:|\WADV:/i, giving us /(^\s*|\W)ADV:/i which you could turn into /\bADV:/i. So, Michael, I'd say that \b wouldn't just work as a replacement for (^\s*|\s+), it'd improve the rule. =) Unless there's a "less is more"-thinking, I'd like to suggest: header ADVERT_CODE Subject =~ /\bADV(ert|erti\w*?)?:/i describe ADVERT_CODE Subject: contains advertising tag Now please excuse me as I go find myself a life. /Tony PS word is an alias for 'echo " web2"; grep !* /usr/share/dict/web2' -- # Per scientiam ad libertatem! // Through knowledge towards freedom! # # Genom kunskap mot frihet! =*= (c) 1999-2002 [EMAIL PROTECTED] =*= # -- Random URL (1/8): <URL: http://eveander.com/sounds/sexysuz.wav > Suzy fell asleep one night... _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk