#!/usr/bin/perl
use strict;
use warnings;
our $quotes = '"' . ('\"' x 10000000) . '"';
print "Length of string is ", length($quotes), "\n";
our @qr;
push @qr, qr/^ " (?: [^"\\]++ | \\. )*+ " /x ;
push @qr, qr/^ " (?: [^"\\]++ | (?: \\. )++ )*+ " /x ;
push @qr, qr/^ " (?: [^"\\]+ | (?: \\. )+ )*+ " /x ;
for my $i (0..$#qr) {
print "$i) $qr[$i] ==> ";
print "NOT " unless $quotes =~ $qr[$i];
print "MATCHED!\n";
}
__END__
Length of string is 20000002
Complex regular subexpression recursion limit (32766) exceeded at ./pm
+1200316.pl line 16.
0) (?^x:^ " (?: [^"\\]++ | \\. )*+ " ) ==> NOT MATCHED!
1) (?^x:^ " (?: [^"\\]++ | (?: \\. )++ )*+ " ) ==> MATCHED!
2) (?^x:^ " (?: [^"\\]+ | (?: \\. )+ )*+ " ) ==> MATCHED!
perl -v
This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-li
+nux-gnu-thread-multi
(with 58 registered patches, see perl -V for more detail)
Copyright 1987-2015, Larry Wall
-QM
--
Quantum Mechanics: The dreams stuff is made of
|