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

javascript - CasperJS/PhantomJS failing SSL handshakes on some sites even with --ssl-protocol=any -

codeigniter - Fatal error: Call to undefined function lang() in CI Merchant using CardSave -

python - Received unregistered task using Celery with Django -