20040711 [CMcC]: here's a little [HTML]/[XML]/[SGML] attribute parser. It's iterative, but it uses regexps extensively. ---- array set match { quote {^([a-zA-Z0-9_-]+)[ \t]*=[ \t]*["]([^"]+)["][ \t]*(.*)$} squote {^([a-zA-Z0-9_-]+)[ \t]*=[ \t]*[']([^']+)['][ \t]*(.*)$} uquote {^([a-zA-Z0-9_-]+)[ \t]*=[ \t]*([^ \t'"]+)[ \t]*(.*)$} } proc parseAttr {astring} { global match array set attr {} set astring [string trim $astring] if {$astring eq ""} { return {} } while {$astring != ""} { foreach m {quote squote uquote} { if {[regexp $match($m) $astring all var val suffix]} { set attr($var) $val set astring [string trimleft $suffix] } } } return [array get attr] } ---- [[[Category HTML] | [Category XML]]]