title: java regex: match input starting with non-number or empty string followed by specific pattern
body: <p>I'm using Java regular expressions to match and capture a string such as:</p>
  
  <p><code>0::10000</code></p>
  
  <p>A solution would be:</p>
  
  <p><code>(0::\d{1,8})</code></p>
  
  <p>However, the match would succeed for the input</p>
  
  <p><code>10::10000</code></p>
  
  <p>as well, which is wrong. Therefore, I now have:</p>
  
  <p><code>[^\d](0::\d{1,8})</code></p>
  
  <p>which means it must lead with any character except a number, but that means there needs to be <strong>some</strong> character before the first zero. What I really want (and what I need help with) is to say "lead with a non-number or nothing at all."</p>
  
  <p>In conclusion the final solution regular expression <strong>should match</strong> the following:</p>
  
  <p><code>
  0::10000<br/>kjkj0::10000
  </code></p>
  
  <p>and <strong>should not</strong> match the following:</p>
  
  <p><code>
  10::10000
  </code></p>
  
  <p><a href="http://www.regexplanet.com/simple/index.html" rel="nofollow">This site</a> may be of use if someone wants to help.</p>
  
  <p>Thanks.</p>