DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=34309>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=34309 Summary: REMatcher freezes Product: ORO Version: 2.0.8 Platform: Other OS/Version: other Status: NEW Severity: normal Priority: P2 Component: Main AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] The following code demonstrates an issue we bumped into using ORO's REMatcher. The following regexp causes the REMatcher to freeze when matching the later two email addresses below. import org.apache.oro.text.regex.MalformedPatternException; import org.apache.oro.text.regex.Pattern; import org.apache.oro.text.regex.Perl5Compiler; import org.apache.oro.text.regex.Perl5Matcher; public class FreezingMatches { private static final String E_ADDRESS_NAME = "(\\w|-)+((\\w|-|.)+)*"; private static final String E_ADDRESS_DOMAIN = "([a-zA-Z0-9]+(\\w|-)*\\.)+[a- zA-Z0-9]{2,4}"; private static final String E_ADDRESS_PATTERN = "^" + E_ADDRESS_NAME + "@" + E_ADDRESS_DOMAIN + "$"; private static final String NAME_ADDRESS_PATTERN = "^[a-zA-Z0-9]+$"; private static final String ADDRESS_PATTERN = "((" + E_ADDRESS_PATTERN + ")| (" + NAME_ADDRESS_PATTERN + "))"; /** * Pattern used to validate recepient email address(es). */ private static Pattern EMAIL_ADDRESS_PATTERN; //public static final String ADDR = "[EMAIL PROTECTED]"; - work OK //public static final String ADDR = "[EMAIL PROTECTED]"; - freezes public static final String ADDR = "[EMAIL PROTECTED]"; - freezes static { Perl5Compiler RECompiler = new Perl5Compiler(); try { EMAIL_ADDRESS_PATTERN = RECompiler.compile( ADDRESS_PATTERN ); } catch (MalformedPatternException e) { e.printStackTrace(); } } public static void main( String[] args ) { Perl5Matcher REMatcher = new Perl5Matcher(); if ( REMatcher.matches( ADDR, EMAIL_ADDRESS_PATTERN ) ) System.out.println( "Matches" ); else System.out.println( "Does not match" ); } } -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
