spamassassin-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karsten Br├Ąckelmann <guent...@rudersport.de>
Subject Re: Bayes refinement
Date Wed, 21 May 2014 20:26:41 GMT
On Wed, 2014-05-21 at 10:23 -0700, Ian Zimmerman wrote:
> I am trying to do a variant of this for text/plain, as that is the type
> I mostly face now.  But I cannot get it to work.

> rawbody __LOCAL_MUCHO_BLANKS /\n{10,}/m

You don't need the "or more" quantifier at the end of your RE. That just
unnecessarily keeps on matching after your lower limit has already been
matched.

Also, the /m multiline modifier is not necessary. It changes ^ and $ to
match anywhere in the string rather than at the beginning and end (of
the string) only. It does not have any impact on \n.


> Feeding message into --debug shows __LOCAL_MUCHO_BLANKS never matches.
> What am I doing wrong?

You are using a bad message for testing. ;)

Seriously, the above rule, the shorter /\n{10}/, as well as the variant
posted by John without quantifier do exactly what you asked for. They
match 10 consecutive \n newline chars in the rawbody.

The test message does not have that string. Maybe it uses DOS flavor
"\r\n". Or what appears to be a bunch of linebreaks actually has spaces
mixed in.


-- 
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;
}}}


Mime
View raw message