You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-dev@jakarta.apache.org by bu...@apache.org on 2002/11/26 15:24:13 UTC
DO NOT REPLY [Bug 14850] -
Search gets frozen for a pattern
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14850>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14850
Search gets frozen for a pattern
dfs@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Additional Comments From dfs@apache.org 2002-11-26 14:24 -------
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.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>