Java RegEx that matches exactly 8 digits
<p>I have a simple RegEx that was supposed to look for 8 digits number:</p>

<pre><code>String number = scanner.findInLine("\\d{8}");
</code></pre>

<p>But it turns out, it also matches 9 and more digits number.
How to fix this RegEx to match exactly 8 digits?</p>

<p>For example: 12345678 should be matched, while
1234567, and 123456789 should not.</p>