Need regex help
-
- Posts: 267
- Joined: Tue Jan 18, 2005 3:24 pm
- Location: Scotland - United Kingdom
Need regex help
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?
/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?
-
- Head of Support
- Posts: 2085
- Joined: Tue Jun 15, 2004 8:50 pm
- Location: Chino Hills, CA, US
- Contact:
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*"
If you want it to match "CRAZY^GALS FATHER*22*OCT*10TH*"
I suggest you find a regex tutorial and read some
This will look for (in lamers terms) "*CRAZY^GALS FATHER*22*OCT*10TH*"
Code: Select all
CRAZY\^GALS FATHER.+22.+OCT.+10TH
Code: Select all
^CRAZY\^GALS FATHER.+22.+OCT.+10TH
-
- Posts: 267
- Joined: Tue Jan 18, 2005 3:24 pm
- Location: Scotland - United Kingdom
-
- Posts: 267
- Joined: Tue Jan 18, 2005 3:24 pm
- Location: Scotland - United Kingdom
Unreal uses Posix regex...
You should probably read the docs...
http://www.vulnscan.org/UnrealIRCd/unre ... html#regex
You should probably read the docs...
http://www.vulnscan.org/UnrealIRCd/unre ... html#regex
-
- Former UnrealIRCd head coder
- Posts: 811
- Joined: Sat Mar 06, 2004 8:47 pm
- Location: United States
- Contact:
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".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).
-- codemastr
-
- Posts: 267
- Joined: Tue Jan 18, 2005 3:24 pm
- Location: Scotland - United Kingdom