Posted to tcl by bairui at Wed Dec 16 22:03:18 GMT 2015view pretty

# aspect's lmap & -inline approach:

set mydict1 [dict create {*}[concat {*}[lmap {_ k v} [regexp -all -inline {(\w+)=((?:.(?!\w+=))*)} [read [open data]]] {list $k $v}]]]


# not using -inline

set mydict2 [dict create {*}[concat {*}[regsub -all -expanded {(\w+)=((.(?!\w+=))*)} [read [open data]] [list {\1 {\2}}]]]]