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=16214>. 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=16214 Character escaping does not always work correctly in RegExp 1.2 Summary: Character escaping does not always work correctly in RegExp 1.2 Product: Regexp Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: Normal Priority: Other Component: Other AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] When matching the string "[EMAIL PROTECTED]", the following regular expression fails with RegExp 1.2. (It works fine in Javascript). "^[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\.\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]+\\@ (\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$" These two expressions that do the same thing, work fine though: "^[a-zA-Z0-9\\x21\\x23\\x24\\x25\\x26\\x27 \\x2A\\x2B\\x2D\\x2E\\x2F\\x3D\\x3F\\x5E\\x5F\\x60\\x7B\\x7C\\x7D\\x7E]+\\@ (\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$") "^[a-zA-Z0-9\\x21\\x23-\\x27\\x2A\\x2B\\x2D-\\x2F\\x3D\\x3F\\x5E-\\x60\\x7B- \\x7E]+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$" The code used for matching is as follows: org.apache.regexp.RE re = new org.apache.regexp.RE (expression); boolean result = re.match ("[EMAIL PROTECTED]"); where expression is one of the three regular expressions above. All three expressions should return the result "true", but the first one returns "false" in RegExp 1.2. Please note: I am no specialist on regular expression syntax. However, to my best knowledge, these expressions should all return the same result. This has been verified by using JavaScript which has regex support. In JavaScript all three expressions evaluate true. Thanks, Peter Nielsen BMT Micro, Inc. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>