title: Using Regex OR operator to solve 2 conditions
body: <p>I am trying to combine 2 regular expressions into 1 with the OR operator: <code>|</code></p>
  
  <p>I have one that checks for match of a letter followed by 8 digits:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Regex.IsMatch(s, "^[A-Z]\d{8}$")
  </code></pre>
  
  <p><br />I have another that checks for simply 9 digits:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Regex.IsMatch(s, "^\d{9}$")
  </code></pre>
  
  <p><br />Now, Instead of doing:</p>
  
  <pre class="lang-vb prettyprint-override"><code>If Not Regex.IsMatch(s, "^[A-Z]\d{8}$") AndAlso
     Not Regex.IsMatch(s, "^\d{9}$") Then 
      ...
  End If
  </code></pre>
  
  <p><br />I thought I could simply do:</p>
  
  <pre class="lang-vb prettyprint-override"><code>If Not Regex.IsMatch(s, "^[A-Z]\d{8}|\d{9}$") Then
      ...
  End If
  </code></pre>
  
  <p><br/>Apparently I am not combining the two correctly and apparently I am horrible at regular expressions.  Any help would be much appreciated.</p>
  
  <p>And for those wondering, I did take a glance at <a href="https://stackoverflow.com/questions/9409171/how-to-combine-2-conditions-and-more-in-regex">How to combine 2 conditions and more in regex</a> and I am still scratching my head.</p>