Page 1 of 1

Help needed with regex

Posted: Mon May 16, 2011 2:40 pm
by b3f0r3
i have some spammers on my network they have started using brackets like this:

Code: Select all

{W}{W}{W} and [W][W][W]
i want to stop evey character wich can be inside these {} [] brackets, btw if there is a place where i can go and understand how spamfilter regex's work it would be great to know.

Thanks in advance...

Re: Help needed with regex

Posted: Tue May 17, 2011 1:22 pm
by Jobe
The best place to read about UnrealIRCd's spamfilter regex syntax is in UnrealIRCd's documentation found at http://www.unrealircd.com/files/docs/un ... html#regex

As for the patterns you asked for, are they in messages or nicks?

Re: Help needed with regex

Posted: Wed Sep 28, 2011 10:16 am
by Bunkerwaiss
try:

Code: Select all

/spamfilter add cpnN block - Some_Text (.*)\{[wW]\}\{[wW]\}\{[wW]\}(.+)
/spamfilter add cpnN block - Some_Text (.*)\[w\]\[w\]\[w\](.+)
/spamfilter add cpnN block - Some_Text (.*)\[W\]\[W\]\[W\](.+)
If in the nick, use instead:

Code: Select all

/spamfilter add u kill - Some_Text (.*)\{[wW]\}\{[wW]\}\{[wW]\}(.+)
/spamfilter add u kill - Some_Text (.*)\[w\]\[w\]\[w\](.+)
/spamfilter add u kill - Some_Text (.*)\[W\]\[W\]\[W\](.+)
For testing purposes only.
If there is some error, please correct me.

Re: Help needed with regex

Posted: Wed Sep 28, 2011 11:58 am
by Stealth
Spamfilters are not case sensitive unless explicitly made to be, and will also match anywhere in the string unless anchored. You also don't need to repeat something, as you can just use the repeat note. Both cases can be wrapped up into 1 spamfilter:

Code: Select all

/spamfilter add cpnN block - Some_Text (\[w\] ?|\{w\} ?){3}
Note I used ( | ) to define the match, you can also use [\{\[] and {\}\}] around each w but it doesn't look as clean. I also included a space and ? in each match to include a possible space between each [W] or {W}. The {3} at the end says that match must repeat 3 times (or more since this is a general match).