my $string = "'" . 'v' x 35_000 . "z'"; print "length of the string is: ", length($string), "\n"; my ($quote, $quoted); ($quote, $quoted) = $string =~ m/^(["'])(.*)\1/; print "dot-star works!\n" if $quoted; # a copy of part of the Text::ParseWords::parse_line() regex ($quote, $quoted) = $string =~ m/^(["'])((?:\\.|(?!\1)[^\\])*)\1/; print "Text::ParseWords fails!\n" unless $quoted;