atom feed1 message in org.perl.perl5-portersregexp limit to 32767 is too small?
FromSent OnAttachments
Igal IancuNov 17, 1997 1:53 am 
Subject:regexp limit to 32767 is too small?
From:Igal Iancu (ian@iil.intel.com)
Date:Nov 17, 1997 1:53:43 am
List:org.perl.perl5-porters

Hi,

I am encoutering a regexp wildcard limit which is too small for certain applications.

here is the program:

================== cut ================= #!/usr/bin/perl5.004

# #create a big string to search in # #Start #0 #0 #0 #. (32767 times) #. #End #

$found=0; $counter=32767; $middle = "0\n" x $counter;

$str = "Start\n" . $middle. "End\n";

while ( $str =~ /Start\n(0\n)*End\n/mg ){ $found++; } print "with $counter, found: $found\n" ;

# #ok, now add just one line to the big string #

$found=0; $counter=32768; $middle = "0\n" x $counter;

$str = "Start\n".$middle."End\n";

while ( $str =~ /Start\n(0\n)*End\n/mg ){ $found++; } print "with $counter, found: $found\n" ;

exit 0; ===================== cut ================

#test.pl with 32767, found: 1 with 32768, found: 0

if the string does not contain "\n", then it can be very long with no problem.

I saw a limitation for 32767 in regexp.c and regcomp.c and tried to bump them up, but was successful only upto 65536, not more. I need at least 10^6 (or actually, unlimited, if possible).

thanks,