[TJE] This little mismatch has bitten me in code, so I thought I'd shed a little more light on the matter for those who may not have picked up on it from the documentation... The ranges placed in a switch statement's "-indexvar" target are inclusive of the character AFTER the match. This differs from the behavior of regexp's "-indices" option, which is exclusive of the same character. Here's a simple example: % set line {foo bar} foo bar % regexp -inline -indices {foo} $line {0 2} % switch -regexp -indexvar index -- $line {foo} {set index} {0 3} As you can see, regexp reports the actual match (character '0' through '2' matches "foo"), whereas switch reports the match PLUS the character after (character '0' through '3' matches "foo "). Don't get bitten! ---- Curiously, [TIP]#75 [http://tip.tcl.tk/75] (which seems to be the only one that specifies this feature) states (emphasis added): : the new option `-indexvar` will also be provided which will name a variable into which a list of match indices (each a two item list of values ''in the same way that [[regexp -indices]]'' computes) will be placed This rather suggests that the stated mismatch is a bug... ---- !!!!!! [Tcl syntax help]|[Arts and crafts of Tcl-Tk programming] !!!!!!