This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
-
Fill
- Halfop
- Posts: 80
- Joined: Sun Jan 18, 2009 6:08 pm
Post
by Fill »
Hi, I'm making a spam protection which is similar to this:
Code: Select all
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.
-
raider2k
- Op
- Posts: 140
- Joined: Tue Jan 01, 2008 10:42 am
Post
by raider2k »
never had any problems using regex before if you set it correctly, in example to yours:
Code: Select all
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.
-
Fill
- Halfop
- Posts: 80
- Joined: Sun Jan 18, 2009 6:08 pm
Post
by Fill »
thanks, worked
I had the ^ and $
-
raider2k
- Op
- Posts: 140
- Joined: Tue Jan 01, 2008 10:42 am
Post
by raider2k »
^ 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

-
Fill
- Halfop
- Posts: 80
- Joined: Sun Jan 18, 2009 6:08 pm
Post
by Fill »
done
