You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Dan Patnode <da...@patnode.net> on 2006/05/06 06:41:51 UTC

RegEx: 2 or More

Studying options for "or more", I've found this example from  
20_drugs.cf:

	body DRUGS_SMEAR1		/(?:Viagra|Valium|Xanax|Soma|Cialis){2}/i
	describe DRUGS_SMEAR1	Two or more drugs crammed together into one word


But doesn't 2 or more need a coma, as in?:

	body DRUGS_SMEAR1		/(?:Viagra|Valium|Xanax|Soma|Cialis){2,}/i


I ask because I'm trying to get this to work, but it stops when {4,}  
is added:

	rawbody OBSFU_HTML /(>\s?[A-Z]\s?<){4,}/i


So as to catch multiple examples of:

 > a<
 >b<
 >c <
 > d<
 >e<
 >f <


Thanks,
Dan

Re: RegEx: 2 or More

Posted by Theo Van Dinter <fe...@apache.org>.
On Fri, May 05, 2006 at 09:41:51PM -0700, Dan Patnode wrote:
> But doesn't 2 or more need a coma, as in?:
> 	body DRUGS_SMEAR1	 /(?:Viagra|Valium|Xanax|Soma|Cialis){2,}/i

If you want to include the "or more" part, yes.  However, "{2}" just means
"2", will include the set of things that match "2 or more".  In short, why
look for a match past 2 if you only care about there being at least 2.

-- 
Randomly Generated Tagline:
"Parser? Parsnip?  What's the difference?" - W. Erickson