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.

Check if nickname is caps lock

Help for those learning Tcl or writing their own scripts.
Post Reply
F
Fill
Halfop
Posts: 80
Joined: Sun Jan 18, 2009 6:08 pm

Check if nickname is caps lock

Post by Fill »

Hi, I'm trying to make a script that kicks users with caps lock on their nick, and to do that, I tried this:

Code: Select all

if {[regexp {[A-Z]} $nick]} { KICK blah blah blah... }
And it DOES work with caps lock nicks, but it also kicks users which have a nickname like "IamYou" (I mean, some capital letters in the middle), and I just want it to detect nicknames with caps lock on all of the letters.

Could you help me with this please?
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

try:

Code: Select all

[regexp {^[A-Z]+$} $nick]
F
Fill
Halfop
Posts: 80
Joined: Sun Jan 18, 2009 6:08 pm

Post by Fill »

worked :wink:

thanks.

But could you explain me what is that command? I wanted to learn it :lol:

Once again, thanks.
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

^ [A-Z]+ $


in this case:

^ - beginning of string
$ - end of string
[A-Z] - set of chars
+ - previous char/set of chars could occur one or more times

Its rly weird.
Better go and study some good tutorial :) (no offense)
F
Fill
Halfop
Posts: 80
Joined: Sun Jan 18, 2009 6:08 pm

Post by Fill »

yeap, it's weird, thanks for the info., I'll search for a good tutorial.

Once again, thanks :)
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Personally, I don't find regular expressions that weird, just a little overwhelming when you deal with them for the first time.

Have a look at the "Regular expression syntax" manpage. I believe you'll find it helpful when dealing with regular expressions. Another good resource would be http://www.regular-expressions.info/tutorial.html
NML_375
F
Fill
Halfop
Posts: 80
Joined: Sun Jan 18, 2009 6:08 pm

Post by Fill »

thanks, great guides!!!
Post Reply