title: How many dots are in a string. (Java)
body: <p>So, I am working on a program in which I need to check if a string has more than one dot. I went and looked at the documentation for <code>regex</code> and found this:</p>
  
  <pre><code>X{n,m}?  X, at least n but not more than m times
  </code></pre>
  
  <p>Following that logic I tried this:</p>
  
  <pre><code>mString = "He9.lo,"
  
  if (myString.matches(".{1,2}?")){
  
      System.out.print("it works");
  }
  </code></pre>
  
  <p>But that does not works (It does not gives any error, it just wont do what is inside the <code>if</code>). I think the problem is that is thinking that the dot means something else. I also looked at this question: <a href="https://stackoverflow.com/questions/11452678/how-to-get-number-data-with-dots-within-a-string">regex</a> but is for php and I don't know how to apply that to java. </p>
  
  <p><strong>EDIT</strong>: Basically I want to know if a string contains more than one dot, for example:</p>
  
  <p>He......lo (True, contains more than one), hel.llo (False, contains one), ..hell.o (True Contains more than one).</p>
  
  <p>Any help would be appreciated. </p>