jakarta-regexp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 4872] New: - RE Reports False Match
Date Wed, 14 Nov 2001 18:36:32 GMT
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:   <mailto:regexp-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:regexp-dev-help@jakarta.apache.org>


Mime
View raw message