title: Regular expression : match either of two conditions?
body: <p>Hi I don't know much about regular expression. But I need it in form validation using angularJs.</p>
  
  <p>Below is the requirement</p>
  
  <p>The input box should accept only if either </p>
  
  <p><strong>(1) first 2 letters alpha  + 6 numeric</strong> </p>
  
  <p><strong>or</strong></p>
  
  <p><strong>(2) 8 numeric</strong></p>
  
  <p>Below are some correct Inputs :-</p>
  
  <p>(1)SH123456
  (2)12345678 
  (3)sd456565 </p>
  
  <p>I tried <code>data-ng-pattern="/(^([a-zA-Z]){2}([0-9]){6})|([0-9]*)?$/"</code> , Its working fine for both the above condition but still it is accepting strings like S2D3E4F5 and may be many other combination as well.</p>
  
  <p>What I am doing wrong I am not able to find it out.</p>
  
  <p>Any help is appreciable !!!</p>
  
  <p>Thanks </p>