title: struggling with conditional regular expressions
body: <p>I have a simple problem, yet i am unable to solve this.
  Either my string has a format <code>ID: dddd</code>, with the following regular expression:</p>
  
  <pre><code>/^ID: ([a-z0-9]*)$/
  </code></pre>
  
  <p>or as follows: <code>ID: 1234 Status: 232</code>, so with the following regular expression:</p>
  
  <pre><code>/^ID: ([a-z0-9]*) Status: ([a-z0-9]*)$/
  </code></pre>
  
  <p>Now i want to make one regular expression that can handle both. The first thing i came up with was this:</p>
  
  <pre><code>/^ID: ([a-z0-9]*)$|^ID: ([a-z0-9]*) Status: ([a-z0-9]*)$/
  </code></pre>
  
  <p>It matches, but i was looking into conditional regular expressions, and was thinking that something should be possible along the lines of (pseudo-codish)</p>
  
  <pre><code>if the string contains /Status:/
      /^ID: ([a-z0-9]*)$/
  else
      /^ID: ([a-z0-9]*) Status: ([a-z0-9]*)$/
  </code></pre>
  
  <p>only, i can't get this expressed correctly. I thought i should be using <code>/?=/</code> but have no clue how.
  Something like</p>
  
  <pre><code>/((?=Status)^ID: ([a-z0-9]*) Status: ([a-z0-9]*)$|^ID: ([a-z0-9]*)$/
  </code></pre>
  
  <p>but that doesn't work.</p>
  
  <p>Can you help?</p>