On Tue, Feb 24, 2009 at 03:52:02PM +0100, Karsten Bräckelmann wrote:
On Tue, 2009-02-24 at 14:54 +0100, Nicolas Haller wrote:
I have a problem. I have a rule like this
header GM_BLAH X-BLAH ~= /^blah$/
If I receive a mail with one header X-BLAH, all is right, the rule
match.
But, If a receive a mail with two header lines X-BLAH, the rule don't
match.
No real rule, no sample that should be hit. Well, guess I see your
problem anyway... ;)
Please do provide useful, stripped-down and carefully crafted examples,
please. The operator is =~ rather than ~=. See my point?
Oops :-)
So, is it normal? What can I do for my rule matching mail with duplicate
header lines?
IIRC the values of headers occuring multiple times are stored in a
single string. Including the newline char.
Ok, I didn't know this.
With your RE modifiers (or the lack thereof), ^ and $ only match the
beginning and end respectively of the string. Notably, they don't match
an embedded newline, as they do with the /m modifier. Also, the '.' does
not match a newline either, unless you specify the /s modifier. See the
perlre documentation for details:
http://perldoc.perl.org/perlre.html#Modifiers
Thank you, you solve my problem :-)
Regards,
--
Nicolas Haller