G; h; s;^[^\n]*\n+;;; x; s;\n.*$;;;
:attribs
-s;class="([^>]+)>[ \t]+\.([^< \t]+);class="\2 \1>;g; t attribs;
-s;>[ \t]+\.([^< \t]+); class="\1">;g;
-s;>[ \t]+#([^< \t]+); id="\1">;g;
-s;>[ \t]+([^ \t=<]+=("[^"]*"|'[^']*'|[^< \t]*)); \1>;g;
+s;class="([^>]+)>[ \t]*\.([^< \t]+);class="\2 \1>;g; t attribs;
+s;(<[^/][^>]*)>[ \t]*\.([^< \t]+);\1 class="\2">;g;
+s;(<[^/][^>]*)>[ \t]*#([^< \t]+);\1 id="\2">;g;
+s;(<[^/][^>]*)>[ \t]*([^ \t=<]+=("[^"]*"|'[^']*'|[^< \t]*));\1 \2>;g;
t attribs;
-s;(<input ([^>]+ )?type=(radio|"radio"|'radio')( [^>]+)?)>[ \t]+checked;\1 checked="checked">;g;
-s;(<input ([^>]+ )?type=(checkbox|"checkbox"|'checkbox')( [^>]+)?)>[ \t]+checked;\1 checked="checked">;g;
-s;(<option( [^>]+))>[ \t]+(checked|selected);\1 selected="selected">;g;
+s;(<input ([^>]+ )?type=(radio|"radio"|'radio')( [^>]+)?)>[ \t]*checked;\1 checked="checked">;g;
+s;(<input ([^>]+ )?type=(checkbox|"checkbox"|'checkbox')( [^>]+)?)>[ \t]*checked;\1 checked="checked">;g;
+s;(<option( [^>]+)?)>[ \t]*(checked|selected);\1 selected="selected">;g;
t attribs;
s;(<[^/][^>]*>)[ \t]*;\1;g;