itcl - need to remove multiple "-" from the string which is alpha numeric using tcl -
i have string:
svpts-7-40.0001
and need remove second '-' this. fetching values these come double '-' sometimes. if such variables seen have remove second '-' , replace same '.' , string should like:
svpts-7.40.0001
[edit] have tried:
% set list1 [split $string -] svpts 7 40.0001 % set var2 [join $list1 .] svpts.7.40.0001 %
here's regular expression change 2nd hyphen:
% regsub -expanded {( .*? - .*? ) -} "svpts-7-40.0001" {\1.} svpts-7.40.0001 % regsub -expanded {( .*? - .*? ) -} "svpts-7_40.0001" {\1.} svpts-7_40.0001 % regsub -expanded {( .*? - .*? ) -} "svpts-7-40.0001-a-b-c" {\1.} svpts-7.40.0001-a-b-c
Comments
Post a Comment