title: Java Pattern Matcher is not working for regex as expected
body: <pre><code>1)  Pattern pattern = Pattern.compile("34238");
     Matcher matcher = pattern.matcher("6003 Honore Ave Suite 101 Sarasota Florida,
     34238");
      if (matcher.find()) {
          System.out.println("ok");
      }
  
  2)  Pattern pattern = Pattern.compile("^[0-9]{5}(?:-[0-9]{4})?$");
      Matcher matcher = pattern.matcher("34238");
      if (matcher.find()) {
          System.out.println("ok");
      }
  </code></pre>
  
  <p>Output for the above code is: <strong>ok</strong></p>
  
  <p>But the following code is not printing anything:</p>
  
  <pre><code>    Pattern pattern = Pattern.compile("^[0-9]{5}(?:-[0-9]{4})?$");
      Matcher matcher = pattern.matcher("6003 Honore Ave Suite 101 Sarasota Florida, 34238");
      if (matcher.find()) {
          System.out.println("ok");
      }
  </code></pre>
  
  <p>What is the reason for this not to print <strong>ok</strong>? I am using the same pattern here also.</p>