DB<154> p $x DB<155> p $y DB<156> $re = qr/ \btype = "([^"]+)" .+? (?: < ( \w+TagIwant)\b | $ ) /x DB<157> print join "|", $x =~ $re MyType|SomeTagIwant DB<158> print join "|", $y =~ $re MyType|