title: JS regex string validation for slug
body: <p>I have an app, that allowing the end user to enter his desired slug. What I am looking for is a regex that check if the slug is valid.</p>
  
  <p>In general, as valid a mean a string that start and ends with a latin leter, divided by dashes but not more than one dashes.</p>
  
  <p>More specific, the following is correct:</p>
  
  <pre><code>one-two-three
  </code></pre>
  
  <p>The following are not:</p>
  
  <pre><code>one---two-thee-
  -one-two-three
  one-two-three-
  </code></pre>
  
  <p>So with the following regex I am somewhow ok, but how can I check if in the middle of the string there are no more than two dashes ?</p>
  
  <pre><code>^[a-z][a-z][a-z]$
  </code></pre>
  
  <p>Is there a better way to write this regex, in order to meet my validation creteria ?</p>