title: Regular Expression If-Else condition example
body: <p>I'm trying to implement a Regular Expression 'if-else' condition. </p>
  
  <p>I saw many examples stating the format as below <code>(?(?=regex)then|else)</code>.</p>
  
  <p>So I gave this a try with: <code>(?(?=a)1|2)</code>.</p>
  
  <p>To my understanding (what I was expecting): If there is a <code>1</code> followed by(positive look ahead) <code>a</code>, Match!. Else search for <code>2</code> and see if there is a match.</p>
  
  <p>Input is as below, I was expecting 1 to get highlighted, but it turns out to be <code>2</code>.</p>
  
  <pre><code>1a
  2a
  </code></pre>
  
  <p>Could someone please tell me why?</p>
  
  <p>Thanks</p>