title: Regex that does not allow consecutive dots
body: <p>I have a Regex to allow alphanumeric, underscore and dots but not consecutive dots:</p>
  
  <pre><code>^(?!.*?[.]{2})[a-zA-Z0-9_.]+$
  </code></pre>
  
  <p>I also need to now allow dots in the first and last character of the string.</p>
  
  <p>How can I do this?</p>