string match ?-nocase? pattern string
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.
LV Does string match use the same code as glob for this?
For the two strings to match, their contents must be identical except that the following special sequences may appear in pattern:
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" }
See also:
Tcl syntax help - Category Command - Category String Processing