Page 1 of 1
How do you quote asterisk with NewsBin 3.32 regular expressi
Posted:
Mon Oct 15, 2001 5:07 pm
by Tony
Hello,
I've had good luck using NewsBin 3.32 regular expressions. Now I'm trying to get a little more fancy. I am trying to block subject lines containing palindrome phrases like this:
"** word1 word2 word1 **"
In this case, I want to match a literal asterisk. In perl, you do this by quoting the asterisk with the backslash character. Like this:
"\*\* word1 word2 word1 \*\*"
However this does not work for me in NewsBin. In fact I can't get any regex to work using backslash to quote the asterisk character. How do you do it?
RE: How do you quote asterisk with NewsBin 3.32 regular expr
Posted:
Mon Oct 15, 2001 11:36 pm
by Axthor
Hi
Try [*][*] words [*][*]
In the past the square brackets were used to specify special
chars such as the period [.].
Axthor
RE: How do you quote asterisk with NewsBin 3.32 regular expr
Posted:
Thu Oct 18, 2001 5:23 pm
by Tony
>Hi
>
>Try [*][*] words [*][*]
>
>In the past the square brackets
>were used to specify special
>
>chars such as the period [.].
>
>
>Axthor
Thank you very much! Your suggestion to use [*] to quote an asterisk worked.
For the record, here's exactly what I settled on. It works quite nicely for me, and maybe it will help someone else.
I entered this in the subject reject list:
^[*][*].*[*][*]$
Explanation:
^ matches beginning of line
[*] matches an asterisk
.* matches everything
$ matches end of line
Thus ^[*][*].*[*][*]$ entered in the subject reject list will reject all subjects that start and end with two asterisks. Anything (any number of any characters) can be between the starting and ending pairs of asterisks. In my experience, such subjects are more than 99% likely to be spam.
RE: How do you quote asterisk with NewsBin 3.32 regular expr
Posted:
Mon Oct 22, 2001 1:15 am
by dexter
I'm surprised. The backslash does work when you are escaping a dot but it doesn't work with other characters including the asterisk and I just tested it with a square bracket. It should work consistently, we'll look into it. Your solution is fine, though, the square brackets define a set of characters from which to match so you could put more than asterisks, you could put tildes or some of the other strange characters I've seen spammers frame their subjects with.
Posted:
Wed Aug 27, 2003 6:21 pm
by Smite
So ever find out why you can't escape a square bracket? Just ran into it again, so...