title: When use java regular-expression pattern.matcher(), source does not match regex.But, my hope result is ,source matches regex
body: <p>When use java regular-expression pattern.matcher(), source does not match regex.But, my hope result is ,source matches regex.</p>
  
  <ul>
  <li><code>String source = "ONE.TWO"</code></li>
  <li><code>String regex = "^ONE\\.TWO\\..*"</code></li>
  </ul>
  
  <pre>
  
      import java.util.regex.Pattern;
  
      public class Test {
          public static void main(String[] args) {
              test();
          }
  
          public static void test() {
              Test stringDemo = new Test();
              stringDemo.testMatcher();
          }
  
          public void testMatcher() {
              String source = "ONE.TWO";
              String regex = "^ONE\\.TWo\\..*";
              // The result = false, "not match". But, the hope result is true, "match"
              matcher(source, regex);
          }
  
          public void matcher(String source, String regex) {
              Pattern pattern = Pattern.compile(regex);
  
              boolean match = pattern.matcher(source).matches();
              if (match) {
                  System.out.println("match");
              } else {
                  System.out.println("not match");
              }
          }
      }
  
  </pre>