twofers wrote:
> I'm writing rules for header Subject and have a rule question.
>  
> I want a rule that would hit on specific words, no matter what order
> they were. Would a rule written like this rule below accomplish that?
>  
> Is the " * " redundant and not needed?
>  
> Would a rule written like this be more efficient and faster than a
> rule where say, each of these words was used in a separate individual
> rule?
>  
> header LR  Subject =~
> / 
> [independent]*[opportunity]*[luxury]*[cowhides]*[win]*[money]*[rep]*[save]*/i
>  
> Thanks.
>  
> Wes
>
>
Well, I wouldn't say that * is redundant.. however, I would say this
entire rule is silly and doesn't do what you want, and it's a little
ambiguous what you're really trying to do.

The whole rule devolves to being any empty regex (//) if you express the
*'s as {0}, meaning this should match *any* text.  I highly doubt that's
what you meant.

Also, you've put the words inside [], which turns them into character
classes.
[win]  will match a single character. a w, an i or an  n, not the word
"win". I doubt that's what you want either.

You probably meant to do something like this:
header LR  Subject =~ /
independent.*\bopportunity\b.*\bluxury\b.*\bcowhides\b.*\bwin\b.*\bmoney\b.*\brep\b.*\bsave\b.*/i

But that will only match if all the words are used IN THAT ORDER.

If you want to match all of them being used in arbitrary order, you'll
have to use multiple rules and combine them with a meta rule.

Or perhaps you were looking to detect if any one of them was used, which
would be this rule:

header LR  Subject =~ /
\b(?:independent.|opportunity|luxury|cowhides|win|money|rep|save)\b/i

Probably very false positive prone, but that works.




Reply via email to