Summary: | Search gets frozen for a pattern | ||
---|---|---|---|
Product: | ORO | Reporter: | Andras Soltesz <soltesz_andras> |
Component: | Main | Assignee: | Jakarta Notifications Mailing List <notifications> |
Status: | CLOSED INVALID | ||
Severity: | blocker | ||
Priority: | P3 | ||
Version: | 2.0.6 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP |
Description
Andras Soltesz
2002-11-26 13:29:29 UTC
Although the behavior is not desirable, it is not quite a bug. Both Perl 5.003_07 and Perl-5.005.03 behave the same way. For example: perl5.003_07/perl -e '@foo=<STDIN>; $bar=join("", @foo); print "$bar"; if ( $bar =~ /package( +)((\w+|\W+)+)( +)is( +|\n)/) { print "MATCH!\n"; }' < foo.txt and perl-5.005.03/perl -e '@foo=<STDIN>; $bar=join("", @foo); print "$bar"; if ( $bar =~ /package( +)((\w+|\W+)+)( +)is( +|\n)/) { print "MATCH!\n"; }' < foo.txt where foo.txt contains: ---------------------------------- package "dlfk"."isam" is isa varchar2(10); procedure isa_as; end; ---------------------------------- This will be fixed as we move to Perl 5.6 compatibility, but right now, we do the same as Perl 5.00x. It is important to remember that regular expressions are state machines and are not guaranteed to terminate. You have to craft reasonable expressions that do not result in excessive or even infinite backtracking and recursion. The problem is easily solved by simplifying the regular expression to the more accurate: package( +)((\w|\W)+)( +)is( +|\n) Notice how (\w+|\W+)+ is equivalent to (\w|\W)+ in what it matches. The expression can be further simplified because "\w|\W" is equivalent to "." We would rather you ask for help on oro-dev before using the bug reporting system. This issues been resolved for a long while. Therefore I'm closing it. |