Hi Martin,
Just answering and questioning things a little bit :)
Nested parenthesis are not supported.
Perfect, it's good to confirm that, I just haven't found
anything about that in the KB.
[] must be escaped since version 8.1x i guess.
That's not what I intend to do, you are supposed to escape them
if you are searching for literal "[" characters. In my case I intend to use
it as a character class definition, something that basically means [ABC] ==
A or B or C
Quote (http://support.ipswitch.com/kb/IM-20040507-DM01.htm):
>Square brackets are now special characters in Rules. As you
had it, your Rule would filter any rule that contains A or D or V in the
Subject.
Now the question would be... does [] support adding predefined
character classes, like \w or \d?
Or in other words, shouldn't this work? [\w\s\=\#\:\.\/\"\'[EMAIL
PROTECTED]
And in the case that works... shouldn't [\w\s\=\#\:\.\/\"\'[EMAIL PROTECTED]
(0 or more times the character class) work also?
RegEx from IMail is a kind of a subset, not everything as you know from
programming is possible with IMail.
200% agreed. What I am trying to do, is to establish the limits
of IMail rules. Because certain rules that are supposed to work, and in fact
they do work in some cases... they don't in others where they should have
worked as well. So something is failing somewhere.
I think, your rule is the absolute limit for IMail.
Why? I mean, after all the rule is well anchored with literals,
and it defines a pretty simple concept. (I have more complex rules for
blocking attachments)
It looks long, just because there is no other way that I know,
in IMail to use say something like: Whatever character except for ">". So
all what I can do is to OR them.
It would certainly be nicer with a [] instead of the OR.
It would be even smaller/nicer/simpler/better with a more
powerfull Regex, like <([\w\W](?!>))+.> which by means of assertion, matches
any whole tag, but I don't expect assertion to be in IMail rules, not even
in my wildest dreams.
So.. final words...
The fact that this rule failes sometimes when it should have
matched, can be classified as a bug. Any doubt about that?
The fact that [\w\s\=\#\:\.\/\"\'[EMAIL PROTECTED] does not work, could be
called a bug, depending on how the rules syntax is defined. I would love to
see a detailed explanation in the IMail Knowledge Base.
And I would be more than happy if any of these ones would work
all the time as expected:
B~<BODY(\w|\s|\=|\#|\:|\.|\/|\"|\'|\@)*>\s*<(\w|\s|\=|\#|\:|\.|\/|\"|\'|\@)*>\s*<(\w|\s|\=|\#|\:|\.|\/|\"|\')*>\s*<IMG(=20|\s)+(\w|\s|\=|\#|\"|\'|\$|\@|\.|\,|\;)*\ssrc=3D\W*cid.\S+:spambox
B~<BODY[\w\s\=\#\:\.\/\"\'[EMAIL PROTECTED]>\s*<[\w\s\=\#\:\.\/\"\'[EMAIL
PROTECTED]>\s*<[\w\s\=\#\:\.\/\"\'[EMAIL PROTECTED]>\s*<IMG[\w\s\=\#\:\.\/\"\'[EMAIL
PROTECTED];\,]*\ssrc=3D\W*cid.\S+:spambox
Even now that the first one works as expected only part of the
time, I am blocking LOTS of those image-only spam.
Warmest regards!
Javier
----- Original Message -----
Date: Wed, 14 Jun 2006 01:19:48 +0200
From: Martin Schaible <[EMAIL PROTECTED]>
Subject: Re: [IMail Forum] Regex failing in IMail Rules
Reply-To: [email protected]
Hi,
- Nested parenthesis are not supported.
- [] must be escaped since version 8.1x i guess.
RegEx from IMail is a kind of a subset, not everything as you know from
programming is possible with IMail.
I think, your rule is the absolute limit for IMail.
============================================
Am Dienstag, 13. Juni 2006 um 23:58 schrieben Sie:
Hi,
This is not the first time that I come accorss something like this
with the regex used by IMail rules.
I have this rule in IMail 8.21:
B~<BODY(\w|\s|\=|\#|\:|\.|\/|\"|\'|\@)*>\s*<(\w|\s|\=|\#|\:|\.|\/|\"|\'|\@)*>\s*<(\w|\s|\=|\#|\:|\.|\/|\"|\')*>\s*<IMG(=20|\s)+(\w|\s|\=|\#|\"|\'|\$|\@|\.|\,|\;)*\ssrc=3D\W*cid.\S+:spambox
It is supposed to catch certain SPAM which has an inline image. In
fact it is working quite well, but somehow, it does not filter always as
expected.
For example, here you have part of an email that was NOT trapped.
It
should have matched... (You can easily test that in perl)
If you test the rule in the IMail GUI, you get false...
Any suggestions?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.2900.2180" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><IMG alt=3D"" hspace=3D0=20
src=3D"cid:[email protected]" align=3Dbaseline=20
border=3D0>><IMG alt=3D"" hspace=3D0=20
src=3D"cid:[email protected]" align=3Dbaseline=20
border=3D0>><IMG alt=3D"" hspace=3D0=20
src=3D"cid:[email protected]" align=3Dbaseline=20
border=3D0>></FONT></DIV>
Also I've found that more complex regex cannot be used, like this
one (see the nested parenthesis with multipliers?):
B~<BODY(\w|\s|\=|\#|\:|\.|\/|\"|\'|\@)*>(\s*<(\w|\s|\=|\#|\:|\.|\/|\"|\'|\@)*>)*\s*<IMG(=20|\s)+(\w|\s|\=|\#|\"|\'|\$|\@|\.|\,|\;)*\ssrc=3D\W*cid.\S+:spambox
Finally, I tried to group with [] as one normally would to define
them as a character class [\w\s\=\#\:\.\/\"\'[EMAIL PROTECTED] but guess what... it
never
matches.
Well, any insights on this will help a lot!
Thanks in advance!
Javier
To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/