On Wed, 2004-03-31 at 03:43, Harry Putnam wrote:
[...]
> > I already have a rule that does what you suggested, it looks like:
> > header M8RAM_FAKE_FROM From =~
> > /(?<!(?:^Bram\sMertens\s)|(?:^Mertens\sBram\s))<my_e-mail-address>/
> > score M8RAM_FAKE_FROM 1.0
> > describe M8RAM_FAKE_FROM From contains my address but I didn't send this!
>
> Is there some reason you can't use the same technique for body?
AFAIK the From =~ /.../ construct only works with header tests.
That is why I tried:
/from\:\s(?<!(?:Bram\sMertens\s)|(?:Mertens\sBram\s))<my_e-mail-address>/i
But for some reason this doesn't work, I think it has to do with the
"look-back" expression, but I don't quite understand how it's supposed
to work in this regex.
Perhaps I need to nest a "look-behind" inside a "look-ahead"?
Something like: "X followed by Y"
where Y is: "Z NOT preceded by W"
Any ideas how I should write this?
I'm thinking about the following section in perldoc perlre:
"(?!pattern)"
A zero-width negative look-ahead assertion. For
example "/foo(?!bar)/" matches any occurrence of
"foo" that isn't followed by "bar". Note how�
ever that look-ahead and look-behind are NOT the
same thing. You cannot use this for
look-behind.
If you are looking for a "bar" that isn't pre�
ceded by a "foo", "/(?!foo)bar/" will not do
what you want. That's because the "(?!foo)" is
just saying that the next thing cannot be
"foo"--and it's not, it's a "bar", so "foobar"
will match. You would have to do something like
"/(?!foo)...bar/" for that. We say "like"
because there's the case of your "bar" not hav�
ing three characters before it. You could cover
that this way: "/(?:(?!foo)...|^.{0,2})bar/".
Perhaps I can use something like:
/From\:\s(?:(?!(?:Bram\sMertens\s)|(?:Mertens\sBram\s))...|^.{0,2})<my_e-mail-address>/
^^^ ^^^^^^^
or:
body M8RAM_FAKE_BOUNCE
/From\:\s(?:(?!(?:Bram\sMertens)|(?:Mertens\sBram).))<my_e-mail-address>/
But this doesn't work, the problem probably lies in the part I don't
understand (marked with ^). Does the above make sense to you?
TIA
--
# Mertens Bram "M8ram" <[EMAIL PROTECTED]> Linux User #349737 #
# SuSE Linux 8.2 (i586) kernel 2.4.20-4GB i686 256MB RAM #
# 8:25am up 9 days 12:01, 11 users, load average: 0.08, 0.05, 0.01 #
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>