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=5212>. 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=5212 Bracketed space [ \-] followed by dash does not match space Summary: Bracketed space [ \-] followed by dash does not match space Product: Regexp Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Other AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] If the pattern contains a space followed by a dash then the RE will not match strings with spaces. This may be related to Bug #2121. If you run the code at the end of this description you should get: RE('[\d \-]') did not match ' ' RE('[ \-\d]') did not match ' ' RE('[ \-]') did not match ' ' RE('[ \-]') did not match '123 ' RE('[ \-]') did not match ' 456' RE('[ \-]') did not match '123 456' The following sample code shows the defect: import org.apache.regexp.*; /** * Tests the org.apache.regexp.RE class * * @author <a href="mailto:[EMAIL PROTECTED]">Declan Whelan</a> * @version <!--$$Revision: 1.2 $--> */ public class RETest { /** * Runs the test suite. * * @param theArgs */ public static void main(String theArgs[]) { try { // all the below should match a space or a dash String[] patterns = { "[\\d\\- ]", "[\\d \\-]", "[ \\d\\-]", "[ \\-\\d]", "[\\- \\d]", "[\\-\\d ]", "[ ]", "[ \\-]", "[\\- ]"}; String[] matchedStrings = {" ", "123 ", " 456", "123 456"}; for (int i=0; i < patterns.length; i++) { RE re = new RE(patterns[i]); for (int j=0; j < matchedStrings.length; j++) { if (!re.match(matchedStrings[j])) { System.err.println("RE('" + patterns[i] + "') did not match '" + matchedStrings[j] + "'"); } } } } catch(RESyntaxException x) { System.err.println(x.getMessage()); } } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>