Search code examples
tclpcre

delimit string in tcl/tk (\b), doesn't it work?


good morning, i am having trouble using string delimitation in tcl, the scape character '\b' does not work, could someone help me? Here's what I'm trying to do:

switch -regexp -matchvar ds $arg_dns {
     \-([aut]?)d([aut]?) {
          puts "achou $ds"        
     }
}

Solution

  • You seem to be expecting the PCRE syntax, where \b is a word boundary. In Tcl's RE syntax (which uses a totally different engine), the equivalent is \y (as \b instead matches a backspace character).