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.

doubts wildcard in a string

Help for those learning Tcl or writing their own scripts.
Post Reply
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

doubts wildcard in a string

Post by juanamores »

I need the code compare the first 4 characters of a string and if they are " ABC- " followed by 5 numeric characters either.
[string range $string 0 8] eq ABC-?????
How wildcards are used "? " ?
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: doubts wildcard in a string

Post by willyw »

See:
http://www.tcl.tk/man/tcl8.5/TclCmd/string.htm#M39


Examples:

<my_handle> .tcl string match "ABC-?????" "ABC-12345"
<botnick> Tcl: 1

<my_handle> .tcl string match "ABC-?????" "abc-12345"
<botnick> Tcl: 0

<my_handle> .tcl string match "ABC-?????" "ZYZ-12345"
<botnick> Tcl: 0


I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Post Reply