# set tag attributes, if any, and create a list set tagattr [join [lrange $linelist 1 end]]; regsub -all {(.*?)="(.*?)"} $tagattr "\\1 {\\2} " tagattr; # make sure the attributes is in lower-case if {![string equal $tagattr ""]}\ { set tmp ""; foreach "a b" $tagattr\ { lappend tmp [string tolower $a]; lappend tmp $b; } set tagattr $tmp; }