if ( my ($line) = $str =~ /^(.*?$regex.*)/m ) { print "Matched Line $line\n" }