title: Regex index 0 how it exactly works
body: <p>By compiling the following:</p>
  
  <pre><code> System.out.println(Pattern.matches(".?(\\d)$","3"));
  </code></pre>
  
  <p>It returns true because before <code>3</code> there is nothing and <code>?</code> check for a one or zero.
  However 3 is already the first character of the input which starts at 0 and end at 1. How can the jvm recognize that there is nothing before 3.
  For example the following.</p>
  
  <p>System.out.println(Pattern.matches(".*","hello");</p>
  
  <p>It returns true as well but only the very last character gets matched with "nothing".
  There should not be a "nothing" character at the beginning of a string, only at the end of it right?</p>