| View previous topic :: View next topic |
| Author |
Message |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Wed Apr 06, 2016 7:24 pm Post subject: doubts wildcard in a string |
|
|
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  |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Wed Apr 06, 2016 10:08 pm Post subject: Re: doubts wildcard in a string |
|
|
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 ! |
|
| Back to top |
|
 |
|