title: Regex for a string with an optional non-repeating dot
body: <p>I need to validate a string in Java to fulfill the following requirements:</p>
  
  <ul>
  <li>string must be 5-32 characters long </li>
  <li>string can contain 
  <ul>
  <li>letters (a-z), </li>
  <li>numbers (0-9), </li>
  <li>dashes (-), </li>
  <li>underscores (_), </li>
  <li>and periods (.).</li>
  </ul></li>
  <li>string mustn't contain more than one period (.) in a row.</li>
  </ul>
  
  <p>Would this regex be be a correct solution?</p>
  
  <pre><code>^(?!([^\\.]*+\\.){2,})[\\.a-z0-9_-]{5,32}$
  </code></pre>