title: Regex for catching port numbers
body: <p>I need a regex to catch the following situations:</p>
  
  <ul>
  <li>Can't have a comma ',123' on the begining;</li>
  <li>Can't have 2 commas '123,,123' together;</li>
  <li>Can't have a comma '123,' on the end;</li>
  <li>Can't have more than 1 hyphen '123-456-789' to range ports, it should be only '123-456';</li>
  </ul>
  
  <p>So far I've come with this:</p>
  
  <pre><code>(^[0-9]+)(^(?!.*(,,)).*$|(([0-9]+\-[0-9]+,?)|([0-9]+,?))+)([0-9]$)
  </code></pre>
  
  <p>This is ok:
  121,123-200,2323</p>
  
  <p>This is not ok:
  ','121,123-200'-'300',,'2323,'-'500','</p>
  
  <p>Thanks in advance</p>