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

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -