string substitution regular expression not working in tcl
- by Puneet Mittal
i am trying to replace all the special characters including white space, hyphen, etc, to underscore, from a string variable in tcl. I wrote the code below but it doesn't seem to be working.
set varname $origVar
puts "Variable Name :>> $varname"
if {$varname != ""} {
regsub -all {[\s-\]\[$^?+*()|\\%&#]} $varname "_"…