title: Construct regex pattern does not match for given invalid input in java
body: <p>I am constructing regex pattern for Android identifiers. Android identifiers should be in the following format as,</p>
  
  <pre><code>&lt;8 character alphaNumeric&gt;-&lt;4 character alphaNumeric&gt;-&lt;4 character alphaNumeric&gt;-&lt;12 character alphaNumeric&gt;
  </code></pre>
  
  <p>Sample android id is,</p>
  
  <pre><code>5f302bf7-97ad-4c24-86f5-823f881d954e
  </code></pre>
  
  <p>So, to match an above format my regex pattern look like,</p>
  
  <pre><code>"^([A-Fa-f0-9]{8}\\" + "-[A-Fa-f0-9]{4}\\" + "-[A-Fa-f0-9]{4}\\"
  </code></pre>
  
  <p>If I gave an invalid Android identifies as,</p>
  
  <pre><code>00000000-0000-0000-0000-000000000000
  </code></pre>
  
  <p>which also matches the above regex pattern.</p>
  
  <p>How to construct regex pattern which doesn't match for above invalid identifiers?</p>