Page 1 of 1

Need regex help

Posted: Wed Jan 19, 2005 4:09 pm
by White_Magic
hi, i need help with a regex. i thought the one i had would ahve worked but it didnt,

/spamfilter add cpPnNq block - - *CRAZY*GALS* + *OCT*10TH* +

the regex set fine, but it didnt block what i wanted it too..

CRAZY^GALS FATHER COMMITED SUICIDE BY SHOOTING HIMSELF IN THE HEAD WITH A 22 ON OCT 10TH BLEW HIS HEAD OFF ACCORDING TO HER AND WAS CREAMATED IN AN I\OPEN CASKET ..BUT SHE doesn't WANT ANY ONE TO KNOW HER PERSONAL BUSINESS SO SHE ONLY TELLS THE IRC

any ideas please?

Posted: Wed Jan 19, 2005 8:20 pm
by Stealth
You shouldn't use the "*" character in a regex. It does something other than what you think it does. Try this:

This will look for (in lamers terms) "*CRAZY^GALS FATHER*22*OCT*10TH*"

Code: Select all

CRAZY\^GALS FATHER.+22.+OCT.+10TH
If you want it to match "CRAZY^GALS FATHER*22*OCT*10TH*"

Code: Select all

^CRAZY\^GALS FATHER.+22.+OCT.+10TH
I suggest you find a regex tutorial and read some :)

Posted: Wed Jan 19, 2005 8:49 pm
by White_Magic
um thanks for the help but i know the difference between * and regex *, ive already read on regexs and perl regexs, i just ahvent had practise putting them into action :)

Posted: Wed Jan 19, 2005 8:53 pm
by Stealth
Well, a tip for the future: "*" == bad; ".+" == good. unless you want to have something match "something" and "some thing", then use some*thing (since "*" is one or nothing or something like that).

Posted: Wed Jan 19, 2005 8:59 pm
by White_Magic
I know secureserv uses perl regex, unreal doesnt use the same does it?

Posted: Wed Jan 19, 2005 9:03 pm
by Dukat
Unreal uses Posix regex...

You should probably read the docs...
http://www.vulnscan.org/UnrealIRCd/unre ... html#regex

Posted: Fri Jan 21, 2005 4:53 pm
by codemastr
Stealth wrote:Well, a tip for the future: "*" == bad; ".+" == good. unless you want to have something match "something" and "some thing", then use some*thing (since "*" is one or nothing or something like that).
That is 100% wrong. First off, it's not "one or nothing" it's "zero or more" (it'll match 5 million characters if that's what it sees). Secondly, it doesn't work how you describe. "some*thing" matches "something" "somthing" "someething" etc. You're saying "match 0 or more 'e'" To match 0 or more of any character, you use .* and, .* IS the equivilent of the * in a wildcard, where as .+ is NOT. So if you have a wildcard of "ab*cd" the correct regex is "ab.*cd" NOT "ab.+cd".

Posted: Sun Jan 23, 2005 10:53 pm
by McTerry
I really, REALLY need to start learning regex'es. :?

Posted: Fri Jan 28, 2005 3:37 am
by White_Magic
the target 'u'
does the ! or @ and : need any kind of escaping?

-> spamfilter add u gzline - - .*[xP].*!.*@.*:.*

Posted: Fri Jan 28, 2005 4:48 pm
by aquanight
No.