This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Perl: maximum number of lines for negative lookahead assertion


Hello,

I'm using the negative lookahead assertion in a regular expression to
parse tokens of a text file that start with a '>'. Some of the tokens can
be very long like 500, 1000 or up to 2000 lines long. It seems that the
negative lookahead assertion fails on tokens that are too many lines long.
For example, if you run the following code on Cygwin Perl version 5.8.6,
the program crashes at line 1547. I'm running this on a Win2K, 512 MB Ram
machine.  Also, I've attached the output from cygcheck -s -r.

I've posted this to perlmonks.org. Please see the discussion at
http://www.perlmonks.org/index.pl?node_id=453725. Grinder asked "I don't
suppose that your Cygwin or Mac builds of Perl do something extra, like running in
utf-8 by default?" Does anybody know if Cygwin Perl runs utf-8 by default?

#!/usr/bin/perl

use strict;

# initially, create a scalar that is 1 line long
my $line = ">"."\n" x 1;
my $incr = 1;

while (1) { # run until it crashes

   while ($line =~ /^(>.*)\n(^(?!>).*\n)+/gm) {
      print "Number of lines: ", length($line)-1,"\n";
   }

   # add another line
   $line .= "\n" x $incr;
}



Thank you,

Paul

Paul Cantalupo
Research Specialist/Systems Programmer
559 Crawford Hall
Department of Biological Sciences
University of Pittsburgh
Pittsburgh, PA 15260
Work: 412-624-4687
Fax: 412-624-4759

Ask me about Toastmasters: www.toastmasters.org
Midday Club Treasurer

Attachment: cygcheck.s.r.out
Description: Text document

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]