DB<6> $type = qr/type="([^"]+)"/; DB<7> print "$_ " for $x =~ /$type .+?(\w+?TagIwant) | $type /x; MyType SomeTagIwant DB<8> print "$_ " for $y =~ /$type .+?(\w+?TagIwant) | $type /x; MyType