title: Regex dealing with dots (.) within words
body: <p>I'm having a hard time on a regex expression. </p>
  
  <p>It's only requirement is that if there is a dot (.) in the word, there must be a letter on either side of the dot. There can be any number of dots in the word and any number of letters in between the dots. There just has to be a letter on either side of a dot.</p>
  
  <p>I have the mostly figured it out but I am having issue with dots that are only separated by one letter (see example below) </p>
  
  <p>Currently I have this expression:</p>
  
  <pre><code>^(\s*[0-9A-Za-z]{1,}[.]{0,1}[0-9A-Za-z]{1,}\s*)+$
  </code></pre>
  
  <p>this works for the following:</p>
  
  <ol>
  <li>dot.InWord </li>
  <li>Multiple.dots.In.Word</li>
  <li>d.ot.s</li>
  <li>t.wo.Le.tt.er.sB.et.we.en.do.ts</li>
  </ol>
  
  <p>However, this does not work for words if the dots are only seperated by one letter, as follows:</p>
  
  <ol>
  <li>d.o.t.s.O.n.l.y.S.e.p.e.r.a.t.e.d.B.y.O.n.e.L.e.t.t.e.r</li>
  </ol>
  
  <p>Anyone know how I could solve this? </p>
  
  <p><strong>EDIT:</strong> </p>
  
  <p><strong>BHustus solution below is the better solution.</strong></p>
  
  <p>However, I did take what BHustus has shown and combined it with what I had before to come up with a less "confusing" pattern just in case anyone else was interested.</p>
  
  <pre><code>^(\s*[\d\w]+([.]?[\d\w]+)+\s*)+$
  </code></pre>
  
  <p>The key was to have the . and the 1 word after be in its own group and repeat. ([.]?[\d\w]+)+</p>
  
  <p>Thanks.</p>