On Wed, 2009-07-01 at 08:01 -0400, Charles Gregory wrote: > On Wed, 1 Jul 2009, Karsten Bräckelmann wrote: > > header FROM_EQ_XM ALL =~ > > /^From: [...@]+\@(?:[^.]+\.)?([^.]+\.[^.]+)>?\$.{0,400}^X-Mailer: \1\$/msi > > Firstly, my thanks. This syntax provides the functionality I was asking > for in another thread where I wanted to capture things like the appearance > of the recipients e-mail address on the subject line, or cases where the > from and to headers are identical.
You're welcome, glad to see it being useful for more than this original question. (BTW, I once at least briefly outlined that To EQ From is possible in a plain header rule, back when this was a recurring topic.) > I haven't tried a rule continaing '\$', but I'm suprised that your usage > seems to contradict the standard rule of escaping special characters to > have them appear literally in an RE. I would guess that this is to keep > Perl from treating the '$' as the indicator of a variable substitution. > Does Perl permit this syntax because of the /m modifier? What if I want a > literal $ in my RE? :) You snipped the part where I claimed the rule to be untested. ;) You are correct, both \$ should actually not be escaped here. When I wrote that, I was looking at a multi-line rule that actually matches a literal $, thus it is escaped... Also, I wrongly escaped the @. Actually, that should be mixed [...@]+\@, not escaped in the char class, escaped outside. Or so I guess. Please try for yourself. I did mention it's a proof-of-concept I did not run, right? ;) > Anyways, thanks again for this neat tool. Now all I need is a way to > detect the 'To' address being used at the top of the message body (as in, > "dear b...@wherever")..... Be careful with 'full' rules. You'd better paranoidly anchor your RE and strictly limit matching, never using unbound quantifiers. A header and body combining rule will be really hard anyway, if safely possible at all. I *strongly* suggest a plugin for this purpose. guenther -- 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; }}}