You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Brian Ipsen <bi...@andebakken.dk> on 2005/11/04 15:46:52 UTC

Custom rule

Hi,

 I'm no expert in creating rules - so hopefully someone can help me with
this simple one:

I want to assign a negative score for all mails, that has the text

JGH Ref.: xxxxxxx

Re: Custom rule

Posted by Matt Kettler <mk...@evi-inc.com>.
Brian Ipsen wrote:
> The xxxxx is numbers - right now, there are 6 digits, but I assume the
> length could be 5-8 digits..
> 
> 
>>Here's a variant assuming it's always a 7-digit number:
>>
>>body LOCAL_JGH	/\bJGH Ref\.: \d{7}\b/
> 
> 
>>Here's one assuming a 5-8 digit alphanumeric (underscores 
>>allowed too, but no other punctuation)
>>
>>body LOCAL_JGH	/\bJGH Ref\.: \w{5,8}\b/
> 
> 
> Seems like the one i need .. Thank you very much :-)


That should work fine.. If you want to be more specific you can replace the \w
with \d, which will only match numbers, but that's probably not necessary.

RE: Custom rule

Posted by Brian Ipsen <bi...@andebakken.dk>.
Hi,

> >  I'm no expert in creating rules - so hopefully someone can help me 
> > with this simple one:
> > 
> > I want to assign a negative score for all mails, that has the text
> > 
> > JGH Ref.: xxxxxxx
> > 
> 
> body LOCAL_JGH	/\bJGH Ref\.: xxxxxxx\b/
> describe LOCAL_JGH 	Has special reference code
> score LOCAL_JGH	-1.0

> However, I assume you'll need something other than xxxxxxx in 
> there.. Is it numbers? Alphanumeric? Is it always the same length?

The xxxxx is numbers - right now, there are 6 digits, but I assume the
length could be 5-8 digits..

> Here's a variant assuming it's always a 7-digit number:
> 
> body LOCAL_JGH	/\bJGH Ref\.: \d{7}\b/

> Here's one assuming a 5-8 digit alphanumeric (underscores 
> allowed too, but no other punctuation)
> 
> body LOCAL_JGH	/\bJGH Ref\.: \w{5,8}\b/

Seems like the one i need .. Thank you very much :-)

Regards,
/Brian

Re: Custom rule

Posted by Matt Kettler <mk...@evi-inc.com>.
Brian Ipsen wrote:
> Hi,
> 
>  I'm no expert in creating rules - so hopefully someone can help me with
> this simple one:
> 
> I want to assign a negative score for all mails, that has the text
> 
> JGH Ref.: xxxxxxx
> 

body LOCAL_JGH	/\bJGH Ref\.: xxxxxxx\b/
describe LOCAL_JGH 	Has special reference code
score LOCAL_JGH	-1.0


However, I assume you'll need something other than xxxxxxx in there.. Is it
numbers? Alphanumeric? Is it always the same length?

Here's a variant assuming it's always a 7-digit number:

body LOCAL_JGH	/\bJGH Ref\.: \d{7}\b/


Here's one assuming a 5-8 digit alphanumeric (underscores allowed too, but no
other punctuation)

body LOCAL_JGH	/\bJGH Ref\.: \w{5,8}\b/