Regular Expression: Not all matches are printed when using System.out.println(m.matches());
<p>I execute the following code:</p>

<pre><code>public static void test() {
 Pattern p = Pattern.compile("BIP[0-9]{4}E");

 Matcher m = p.matcher("BIP1111EgjgjgjhgjhgjgjgjgjhgjBIP1234EfghfhfghfghfghBIP5555E");
 System.out.println(m.matches());
 while(m.find()) {
  System.out.println(m.group());
 }
</code></pre>

<p>}</p>

<p>What i cannot explain is when the code is executed with <strong>System.out.println(m.matches());</strong> the matches printed are: <strong>BIP1234E</strong> and <strong>BIP5555E</strong>.
but when <strong>System.out.println(m.matches());</strong> is removed from code the matche <strong>BIP1111E</strong> is also printed.</p>

<p>Can someone please explain how that's possible ? Thnx a lot for your help.</p>
