#!/usr/bin/perl use strict; use warnings; $_ = '"' . ('\"' x 100000) . '"'; print "NOT MATCHED!\n" unless /^ " (?: [^"\\]++ | \\. )*+ " /x ; # as recommended by perlre(1) # why does this use recursion (rather than iteration)? #Output under perl v5.24.1: # Complex regular subexpression recursion limit (32766) exceeded at line 6. # NOT MATCHED!