Forum Discussion
hooleylist
May 04, 2010Cirrostratus
That's really odd. switch -glob should use the same logic as 'string match'. I don't think the period has any significance as a wildcard for string matching:
http://www.tcl.tk/man/tcl8.4/TclCmd/string.htmM35
I couldn't reproduce this non-matching of .'s using string match or switch in 10.1:
tclsh
% string match "a.b.c." "aabbcc"
0
% string match "a.b.c." "a.b.c."
1
when RULE_INIT {
log local0. "[string match "a.b.c." "a.b.c."]"
log local0. "[string match "a.b.c." "aabbcc"]"
switch -glob "a.b.c." {
"a.b.c." {
log local0. "matched a.b.c."
}
"aabbcc" {
log local0. "matched aabbcc"
}
default {
log local0. "no match"
}
}
}
: 1
: 0
: matched a.b.c.
Aaron