Page 1 of 1

regex problem

Posted: Mon Feb 21, 2011 4:06 pm
by one4two
Hi everyone :)

Im not sure why the following doesnt work

I want to care for eg: ( its always like !cmd_text (_ = space)

!send .cant.this starting with . should be blocked, but doesnt work
!send cant.this. ends with . works - is blocked

Here's my regex:

Code: Select all

spamfilter { regex "^!(sup|send)(.*)(^[^a-zA-Z0-9]+|[^a-zA-Z0-9]+$)";
Can someone tell what im doing wrong ?

Re: regex problem

Posted: Thu Feb 24, 2011 6:53 am
by Stealth
Give examples of exactly what you want blocked (at least 5 please) so we know exactly what you need.

Re: regex problem

Posted: Fri Feb 25, 2011 11:40 am
by one4two
!send .cant.this
!send cant.this.
!send this.is.another.test+
!send (should.not.work
!send why.is.it.cold$
!send was.it.that.late!

If the part after !send - seperated with a space - starts or ends with an non alphanumeric char, it should be blocked.

Re: regex problem

Posted: Sat Feb 26, 2011 6:57 am
by Stealth
This is the best I could come up with:

Code: Select all

^!send (\W.+|.+\W)$

Re: regex problem

Posted: Sat Feb 26, 2011 9:54 am
by one4two
Many thanks !