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=23303>.
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=23303

Perfomance problem with matching ^(_?[A-Z0-9]+)*$ pattern

           Summary: Perfomance problem with matching ^(_?[A-Z0-9]+)*$
                    pattern
           Product: Regexp
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Other
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The follows program requires more then 1 minute to check 
if given string matchs a pattern (some users will think that jvm hangs).
BTW if I remove last unterscope in the string the program
works less then 1 ms.

import org.apache.regexp.RESyntaxException;
import org.apache.regexp.RE;

public class RegexpTest {
    public static void main(String[] args) {
        String format = "^(_?[A-Z0-9]+)*$";
        String bad_str = 
            "_NOERROR_AND_LAST_TXN_NOT_OK_AND_LAST_TXN_WAS_";
        try {
            RE regexp = new RE(format);
            long before = System.currentTimeMillis();
            System.err.println(regexp.match(bad_str));
            long after = System.currentTimeMillis();
            System.err.println(after-before);
        }
        catch(RESyntaxException e) {
            e.printStackTrace();
        }
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to