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.

regexp problem

Old posts that have not been replied to for several years.
Locked
User avatar
z_one
Master
Posts: 269
Joined: Mon Jan 14, 2002 8:00 pm
Location: Canada

regexp problem

Post by z_one »

Hi,

I'm using the following condition to detect nicks who have 5 or more consecutive consonants (possible spammers)

Code: Select all

if {[regexp -nocase {[^a,e,i,o,u,y]{5,}} $nick]} {
  ban and kick here...
}
However when the nick A---NoSpam joined my channel ... he got kicked. What's wrong ?

Thanks
d
darko``
Op
Posts: 121
Joined: Sun Sep 08, 2002 5:33 pm
Location: Malta

Post by darko`` »

% [darko@blah darko]$ tclsh
% set nick A---NoSpam
A---NoSpam
% regexp -nocase {[^a,e,i,o,u,y]{5,}} $nick
0
%

Guess that explains it. There is no problem with your regexp.
Ignorant and lazy people will save 30 minutes by chosing simple config file. Smart ones will save 3000 minutes of *everyone's* time by opting for complete config file.
User avatar
z_one
Master
Posts: 269
Joined: Mon Jan 14, 2002 8:00 pm
Location: Canada

Post by z_one »

Thx for debugging that ... however the bot was banning the ip of the nick A---NoSpam as soon as it joined.
When I removed the code I showed you from my eggy, it stopped banning the nick.
That's what puzzles me!
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

As said in most situation like this, we would need to see the rest of the script, to so if there any other issues at hand affecting this.
User avatar
z_one
Master
Posts: 269
Joined: Mon Jan 14, 2002 8:00 pm
Location: Canada

Post by z_one »

Code: Select all

bind join - * possiblespamnick

proc possiblespamnick {nick host hand chan} {
    global botnick
    if {$nick == $botnick} { return 0 }
    if {[matchattr $hand "n"] || [matchattr $hand "m"] || [matchattr $hand "b"]} { return 0 } {
      if {[regexp -nocase {[^a,e,i,o,u,y]{5,}} $nick]} {
        putkick $chan $nick "Possible spammer detected"
      }
    }
}
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Well considering that there is no banning code in what you posted, it is limpossible for this to be causing the bans heh.

Maybe you're using some other script. Search for "newchanban" or "+b".
User avatar
z_one
Master
Posts: 269
Joined: Mon Jan 14, 2002 8:00 pm
Location: Canada

Post by z_one »

There is a ban code but I took it out.
Anyway, it's the same. With the code I posted the bot kicks the nick
A---NoSpam eventhough I unloaded all other tcl files and only kept this one :-?
Could it be that the character "-" denotes some sort of special meaning ?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Maybe you have some weird version of tcl and it does regexp differently than on our computers.

Test the regexp by itself with the .tcl command:

.tcl regexp -nocase {[^a,e,i,o,u,y]{5,}} "A---NoSpam"

If that returns 0, then you're having some other error. Have you done .restart lately? Maybe you have an old version of the script still loaded hehe.

If it returns 1, then reinstall Tcl or use a different method of detecting bad nicks.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

I realy can't see any way of this happening, other than the proc being renamed after originaly starting the script.

IE. You start the script, change stuff around, including the name of the proc, and then do a rehash.

This would cause the original script, to remain in memory, and is possibly where to problems arise. Try a .restart to test it.

Another thing to try, is placing -- after the -nocase switch.
d
darko``
Op
Posts: 121
Joined: Sun Sep 08, 2002 5:33 pm
Location: Malta

Post by darko`` »

And why did you take out the ban code from your posting? You should post, and i cannot stress this enough, *THE FULL ORIGINAL* version of the script. Some tiny details often cause problems but easily get overloked.
Ignorant and lazy people will save 30 minutes by chosing simple config file. Smart ones will save 3000 minutes of *everyone's* time by opting for complete config file.
User avatar
z_one
Master
Posts: 269
Joined: Mon Jan 14, 2002 8:00 pm
Location: Canada

Post by z_one »

What I need this code to do is
1- detect nicks having 5 or more successive consonants (i.e. agubnftrd)
2- the successive consonants should be different (i.e. it should not react on nicks such as "afojjjjjj")
3- the nick should only contain letters (i.e. it should not react on nicks such as "drummer21")

Thanks in advance.

here is the code :wink:

Code: Select all

bind join - * kickit
proc kickit {nick host hand chan} {
    global botnick
    if {$nick == $botnick} { return 0 }
      if {[regexp -nocase {[^a,e,i,o,u,y]{5,}} $nick]} {
        newchanban $chan "*!$host" $botnick "Out" 10
        putkick $chan $nick "Out! 10 mins ban"
      }
}
Locked