See if pattern matches string; return 1 if it does, 0 if it doesn't. If -nocase is specified, then the pattern attempts to match against the string in a case insensitive manner.
Compare string equal which compares entire strings or parts of strings but NOT expressions.
For the two strings to match, their contents must be identical except that the following special sequences may appear in pattern:
Beware that the parsing of strings inside grouping [] is not particularly robust -- neither the manual, the tests nor the code takes pains to specify how to interpret combinations of []*?- inside brackets. If you need a character class which includes any of these special characters, you are probably better off with a [regexp. (see also [L1 ]).
LV Does string match use the same code as glob for this?
No.
set hin [open "/tmp/sample.txt" "r"] set data [read $hin] close $hin if [ string match -nocase "*test*" $data ] { puts "Found test" } else { puts "Did not find test" }