Need regex help

These are old archives. They are kept for historic purposes only.
Post Reply
White_Magic
Posts: 267
Joined: Tue Jan 18, 2005 3:24 pm
Location: Scotland - United Kingdom

Need regex help

Post 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?
Stealth
Head of Support
Posts: 2085
Joined: Tue Jun 15, 2004 8:50 pm
Location: Chino Hills, CA, US
Contact:

Post 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 :)
White_Magic
Posts: 267
Joined: Tue Jan 18, 2005 3:24 pm
Location: Scotland - United Kingdom

Post 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 :)
Stealth
Head of Support
Posts: 2085
Joined: Tue Jun 15, 2004 8:50 pm
Location: Chino Hills, CA, US
Contact:

Post 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).
White_Magic
Posts: 267
Joined: Tue Jan 18, 2005 3:24 pm
Location: Scotland - United Kingdom

Post by White_Magic »

I know secureserv uses perl regex, unreal doesnt use the same does it?
Dukat
Posts: 1083
Joined: Tue Mar 16, 2004 5:44 pm
Location: Switzerland

Post by Dukat »

Unreal uses Posix regex...

You should probably read the docs...
http://www.vulnscan.org/UnrealIRCd/unre ... html#regex
codemastr
Former UnrealIRCd head coder
Posts: 811
Joined: Sat Mar 06, 2004 8:47 pm
Location: United States
Contact:

Post 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".
-- codemastr
McTerry
Posts: 64
Joined: Tue Oct 19, 2004 12:42 am
Location: *.se
Contact:

Post by McTerry »

I really, REALLY need to start learning regex'es. :?
BOOM!
White_Magic
Posts: 267
Joined: Tue Jan 18, 2005 3:24 pm
Location: Scotland - United Kingdom

Post by White_Magic »

the target 'u'
does the ! or @ and : need any kind of escaping?

-> spamfilter add u gzline - - .*[xP].*!.*@.*:.*
aquanight
Official supporter
Posts: 862
Joined: Tue Mar 09, 2004 10:47 pm
Location: Boise, ID

Post by aquanight »

No.
Post Reply