develooper Front page | perl.beginners | Postings from January 2002

regexp hangs in perl 5.005_03 but not 5.6

From:
Jon Molin
Date:
January 17, 2002 02:03
Subject:
regexp hangs in perl 5.005_03 but not 5.6
Message ID:
3C46A0DA.B4166273@resfeber.se
Hi list,

I've got a pretty hairy regexp that hangs and i can't really understand
why. It works just fine one my freebsd workstation running 5.6.1, but in
linux with 5.005_03 it just dies.

here is the code:
$rule = "A. TRAVEL ON BB CODESHARE ABTS BB1000 - BB7999 AND
BB9000-BB9999 NOT PERMITTED
B. TRAVEL ON AA FIPS AA3000-AA3999, AA6000-AA6999,
AA8000-AA8999, AA9300-AA9999 NOT PERMITTED";
print STDERR "start\n";
@temp = $rule =~
/TRAVEL\s*ON\s*((?:[\s.]*(?:..\/)?..\s*(?:CODESHARE\s*)?(?:FIPS|ABTS)\s*(?:SERIES\s*)?(?:(?:..)?\d+|-|=|\s+|AND|,)*)*)\s*IS\s*NOT\s*ALLOWED/isg;
print STDERR "end\n";


now this regexp doesn't match at all, as 'IS\s*NOT\s*ALLOWED' isn't in
the $rule string. If i remove FIPS| in the regexp it works but it still
hangs if i remove ABTS. Here's where it stops :

write(2, "start\n", 6start
)                  = 6
brk(0x80d2000)                          = 0x80d2000


/Jon



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About