DB<132> p $x DB<133> $re = qr/\btype="([^"]+)".+?<(\w+TagIwant\b|$)/ DB<134> print join "|", $x =~ $re MyType|SomeTagIwant