Bug 31719

Summary: Bad performance with simple expressions
Product: Regexp Reporter: Roi Gilboa <roi_gilboa>
Component: OtherAssignee: Jakarta Notifications Mailing List <notifications>
Status: CLOSED DUPLICATE    
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: other   

Description Roi Gilboa 2004-10-14 15:16:31 UTC
Try the following Rexp:
^[a-zA-Z]{0,99}$
(Allows any sequence of alpha characters up to the length of 99)

If you type 'aa bbbb' (white space), it returns false very fast.
If you type 'aaaa bbbb' (again, white space) it returns false after long time
consuming much CPU.
Comment 1 Roi Gilboa 2004-10-14 15:24:02 UTC
I also noticed that if the length of the expression is {1,99} and not {0,99} it
does not occur.
I also believe that longer character sequence before the space increases the
processing time significantly.

The problem reproduces using the sample Applet.
Comment 2 Oleg Sukhodolsky 2005-07-21 11:37:51 UTC
I think this is the same as 9153 (RE.match() hangs when using {n,m})
Comment 3 Vadim Gritsenko 2005-08-11 05:15:05 UTC
Yes, it is.

*** This bug has been marked as a duplicate of 9153 ***