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

Line ending issue with Mercurial or Visual Studio -

tags - Jquery Mixitup plugin help prevent handlers being destroyed -

c# - Delving into the world of XML (Windows Phone) Error I dont understand (The ' ' character, hexadecimal value 0x20, cannot be included in a name.) -