http://qs321.pair.com?node_id=1200600


in reply to Re^2: What regex can match arbitrary-length quoted string?
in thread What regex can match arbitrary-length quoted string?

Hmmm...I get "NOT MATCHED!", but no error message. But there are other inconsistencies.

Putting several into a single script:

#!/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