regex - tcl: parse string into list -


i'm trying parse string flat list in tcl.

the string has format of

name1='value1',name2='value2',name3='value3' 

i'm wondering if there's way capture names , values list looks this:

{name1 value1 name2 value2 name3 value3} 

note name or value may contain includes characters ' or = or ,

well, possible

set data {name1='value1',name2='value2',name3='value3'} foreach {- key value -} [regexp -all -inline {(.*?)='(.*?)'(,|$)} $data] {     lappend result $key $value } 

note: if key occurs once, suggest using dicts (dict set result $key $value).


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -