title: PHP Regular Expression - {0,1}, ?, etc
body: <p>Regular expression pattern:</p>
  
  <pre><code>[[1-9]-]?[a-zA-Z1-9]
  </code></pre>
  
  <p>Shouldn't the following strings match?:</p>
  
  <pre><code>2-
  5-
  2-S
  5-t
  S
  t
  </code></pre>
  
  <p>What am I not understanding here? <BR></p>
  
  <hr>
  
  <p>Also Tried:</p>
  
  <pre><code>[[1-9]-]{0,1}[a-zA-Z1-9]
  [[1-9]-|][a-zA-Z1-9]
  [[[1-9]-]|][a-zA-Z1-9]
  </code></pre>
  
  <hr>
  
  <h2>Goal</h2>
  
  <p>Trying to come up with a pattern for: <BR></p>
  
  <pre><code>1st character = Number 1-9
  2nd character = always "-"
  3rd character = Alphanumeric (all cases, 1-9)
  4rd character = Alphanumeric (all cases, 0-9) Repeat X number of times
  OR
  1rd character = Alphanumeric (all cases, 1-9)
  2rd character = Alphanumeric (all cases, 0-9) Repeat X number of times
  </code></pre>
  
  <p>(i realize i haven't implemented the repeat portion in the code given here yet)</p>
  
  <hr>