Help needed with regex

These are old archives. They are kept for historic purposes only.
Post Reply
b3f0r3
Posts: 1
Joined: Mon May 16, 2011 2:16 pm

Help needed with regex

Post by b3f0r3 » Mon May 16, 2011 2:40 pm

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...

Jobe1986
Official supporter
Posts: 1177
Joined: Wed May 03, 2006 7:09 pm
Location: United Kingdom

Re: Help needed with regex

Post by Jobe1986 » Tue May 17, 2011 1:22 pm

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?

Bunkerwaiss
Posts: 36
Joined: Thu Dec 27, 2007 8:48 am

Re: Help needed with regex

Post by Bunkerwaiss » Wed Sep 28, 2011 10:16 am

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.

Stealth
Head of Support
Posts: 2086
Joined: Tue Jun 15, 2004 8:50 pm
Location: Chino Hills, CA, US
Contact:

Re: Help needed with regex

Post by Stealth » Wed Sep 28, 2011 11:58 am

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).

Post Reply