From regexp-dev-return-259-qmlist-jakarta-archive-regexp-dev=jakarta.apache.org@jakarta.apache.org Fri Nov 30 19:29:47 2001 Return-Path: Delivered-To: apmail-jakarta-regexp-dev-archive@apache.org Received: (qmail 33696 invoked from network); 30 Nov 2001 19:29:46 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 30 Nov 2001 19:29:46 -0000 Received: (qmail 3099 invoked by uid 97); 30 Nov 2001 19:29:41 -0000 Delivered-To: qmlist-jakarta-archive-regexp-dev@jakarta.apache.org Received: (qmail 3043 invoked by uid 97); 30 Nov 2001 19:29:40 -0000 Mailing-List: contact regexp-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Regexp Developers List" Reply-To: "Regexp Developers List" Delivered-To: mailing list regexp-dev@jakarta.apache.org Received: (qmail 3011 invoked by uid 50); 30 Nov 2001 19:29:39 -0000 Date: 30 Nov 2001 19:29:39 -0000 Message-ID: <20011130192939.3008.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: regexp-dev@jakarta.apache.org Cc: Subject: DO NOT REPLY [Bug 5212] New: - Bracketed space [ \-] followed by dash does not match space X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . 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: regexp-dev@jakarta.apache.org ReportedBy: dwhelan@innovasys.com 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 Declan Whelan * @version */ 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: For additional commands, e-mail: