Artifacts Associated With Ticket 787339ffffffffff
Ticket change [e9d1c66faa] (rid 104872) by nobody on 2003-08-12 11:21:42:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
string match fails if pattern contains the meta-chars *, \ , [, ] or ?, even using backslash in pattern (as man page states). * and ? meta chars are always interpreted as meta, even if backslashed. The remaining ones are never matched. Reproducible bug: string match "\*" "sjdjshddsdsj" gives 1 set a "jashjdhasjd\\" string match "\\" $a gives 0 Expected result: for the first example: false, because trailing backslash should force the * to be interpreted as literal. for the second example: true, because $a contains a backslash How to circumvent: use regexp with ascii encoding (braces are mandatory): regexp {\x02a} "hsajdhds*sadd" gives 1 while regexp {\x02a} "hsajdhdssadd" gives 0, and so on. \ = 05c * = 02a ? = 03f [ = 50b ] = 05d [email protected] - foundin initialized to: "obsolete: 8.4.4"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "18. Commands M-Z"
- title initialized to: "string match failure with meta-characters"
- type initialized to: "Bug"
Ticket change [ac36cf351b] (rid 101253) by dkf on 2003-08-12 20:31:10:
- closedate changed to: "2003-08-12T13:31:10"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 You're getting caught out by the standard Tcl quoting rules which always apply. Try: string match {\*} $yourString instead of: string match "\*" $yourString though the following should work too: string match "\\*" $yourString - login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- username: "dkf"