On Thu, 2010-11-04 at 18:08 -0230, Lawrence @ Rogers wrote:
> On 04/11/2010 5:56 PM, Karsten Bräckelmann wrote:

> > > header __LW_EMPTY_SUBJECT Subject =~ /[[:space:]]$/
> > That rule does *not* do what you intend. It matches, if the last char of
> > the Subject happens to be a whitespace.
> >
> > By definition, that header is not empty. Moreover, it is not equivalent
> > to a header that has no printable chars, which seems to be what you
> > actually tried the RE to match.
> 
> How's about this then

No offense meant, Lawrence, but I strongly suggest you should at least
read up on some (Perl) RE introduction before writing such rules.
perlre [1] is *the* reference. You'll find suitable introduction docs in
its Description section.

Also, actually test your rules against the samples.

> # Message has empty To: and Subject: headers
> header __LW_EMPTY_SUBJECT Subject =~ /^[[:space:]]$/

No, that requires the Subject to consist of exactly one whitespace.

Read it out load. The ^ beginning of the string, followed by exactly one
whitespace char [2]. Followed by the $ end of the string.


[1] http://perldoc.perl.org/perlre.html
[2] A char [class] is just a char class, an alternation. It still is a
    single char in length, unless a quantifier is given.

-- 
char *t="\10pse\0r\0dtu...@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; }}}

Reply via email to