You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-dev@jakarta.apache.org by bu...@apache.org on 2001/11/14 19:36:32 UTC
DO NOT REPLY [Bug 4872] New: -
RE Reports False Match
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=4872>.
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=4872
RE Reports False Match
Summary: RE Reports False Match
Product: Regexp
Version: unspecified
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Major
Priority: Other
Component: Other
AssignedTo: regexp-dev@jakarta.apache.org
ReportedBy: davepwhite@hotmail.com
import org.apache.regexp.*;
public class regexpFailure {
private static final String phoneNumberPattern =
"^\\(?(\\d{3})\\)?[-| ]?(\\d{3})[-| ]?(\\d{4})$";
private static String bogusPhoneHasPlus = "(425) 576+1202";
public static void main(String[] args) {
try {
RE re = new RE(phoneNumberPattern);
if(re.match(bogusPhoneHasPlus)) {
System.out.println("RE matches and should not");
}
else {
System.out.println("RE does not match as expected");
}
}
catch (RESyntaxException e) {
throw new IllegalStateException("Failed to process s_phoneRegexp.");
}
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>