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

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

regexp

Post by iamdeath »

Currently this is to check if a nickname contains "alphabetnumberalphabet" for ex:

abcd33ad or eekk556xnxn

Code: Select all

if { [regexp -nocase {^[a-z]\d{1,}[a-z]$} $nick]} { 
How can I make it scan only "alphabet2digits" for ex:

abcd12 or aaa33 or dniionoin99

So two digits in the end and alphabets in the start.
can you make me that experession.

Thanks
iamdeath
|AmDeAtH @ Undernet
Death is only the *Beginning*...
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

^[[:alpha:]]+[[:digit:]]{2}$
NML_375
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

nml375 wrote:^[[:alpha:]]+[[:digit:]]{2}$
You can use this too:

Code: Select all

if {[regexp -nocase {^[a-z]{3,}[0-9]{2}$} $nick]} { blah }
r0t3n @ #r0t3n @ Quakenet
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Not quite the same, as [:alpha:] covers all alphabet-characters, not only a-z...
Also, if you were to replace + with a {n,} construct, n should be one (1) and not three (3)
NML_375
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Thanks I'll give it a try.
|AmDeAtH @ Undernet
Death is only the *Beginning*...
Post Reply