Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: What regex can match arbitrary-length quoted string?

by QM (Parson)
on Oct 03, 2017 at 10:46 UTC ( #1200600=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1200600]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2018-02-22 19:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (298 votes). Check out past polls.

    Notices?