| View previous topic :: View next topic |
| Author |
Message |
Fill Halfop
Joined: 18 Jan 2009 Posts: 80
|
Posted: Tue Apr 07, 2009 8:49 am Post subject: [Solved] Regexps checking the whole message |
|
|
Hi, I'm making a spam protection which is similar to this:
| Code: |
proc spam { nick uhost hand chan text } {
if {[regexp {regexp_here} $text]) { kick blah blah }
}
|
However it only works if someone sends one-word-message
Example:
<Fill> www.test.net
(worked and kicked me)
<Fill> visit my website www.test.net and comment it!
(didn't work)
I think I'll have to use regsub or something, but I dunno how to use it. Any help will be appreciated.
Fill
Last edited by Fill on Tue Apr 07, 2009 5:53 pm; edited 1 time in total |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Tue Apr 07, 2009 9:08 am Post subject: |
|
|
never had any problems using regex before if you set it correctly, in example to yours:
| Code: | | if {[regexp -all -nocase -- {www\.test\.(net|com)} $text]} { kick blah blah } |
would match
www.test.net
www.test.com
someone knows www.test.net?
on www.test.com there is news
unless you dont put ^ in front of the www and $ behind the (net|com) in my example its going to match either the regex alone or in a sentence. |
|
| Back to top |
|
 |
Fill Halfop
Joined: 18 Jan 2009 Posts: 80
|
Posted: Tue Apr 07, 2009 11:49 am Post subject: |
|
|
thanks, worked
I had the ^ and $ |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Tue Apr 07, 2009 2:03 pm Post subject: |
|
|
^ and $ are limiters that define a limit where to start and where to end
by the way: add [SOLVED] to your topic if solved please  |
|
| Back to top |
|
 |
Fill Halfop
Joined: 18 Jan 2009 Posts: 80
|
Posted: Tue Apr 07, 2009 5:53 pm Post subject: |
|
|
done  |
|
| Back to top |
|
 |
|