egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Check if nickname is caps lock

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Mon Feb 23, 2009 8:59 am    Post subject: Check if nickname is caps lock Reply with quote

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:

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?
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Mon Feb 23, 2009 9:39 am    Post subject: Reply with quote

try:
Code:
[regexp {^[A-Z]+$} $nick]
Back to top
View user's profile Send private message Visit poster's website
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Mon Feb 23, 2009 2:05 pm    Post subject: Reply with quote

worked Wink

thanks.

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

Once again, thanks.
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Mon Feb 23, 2009 3:01 pm    Post subject: Reply with quote

^ [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 Smile (no offense)
Back to top
View user's profile Send private message Visit poster's website
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Wed Feb 25, 2009 5:10 am    Post subject: Reply with quote

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

Once again, thanks Smile
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Feb 25, 2009 1:15 pm    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Sat Feb 28, 2009 6:11 pm    Post subject: Reply with quote

thanks, great guides!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber