title: Lookahead, lookbehind condition in regular expression
body: <p>The following example is about using lookahead assertion as a condition. I found it in the PHP manual at: <a href="http://www.php.net/manual/en/regexp.reference.conditional.php" rel="nofollow">http://www.php.net/manual/en/regexp.reference.conditional.php</a></p>
  
  <pre class="lang-none prettyprint-override"><code>(?(?=[^a-z]*[a-z])
  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} )
  </code></pre>
  
  <p>Here's the description about this regex:</p>
  
  <blockquote>
    <p>The condition is a positive lookahead assertion that matches an optional sequence of non-letters followed by a letter. In other words, it tests for the presence of at least one letter in the subject. If a letter is found, the subject is matched against the first alternative; otherwise it is matched against the second. This pattern matches strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits.</p>
  </blockquote>
  
  <p>Could anyone tell me why we use lookahead assertion as the condition in this example? Why don't we use lookbehind assertion? I get confused when they're used as conditions like this because I don't know how do they match the subject string. Thanks in advance!</p>