title: does java support if-then-else regexp constructs(Perl constructs)?
body: <p>I receive PatternSyntaxException when try to compile the following regex:</p>
  
  <pre><code>"bd".matches("(a)?b(?(1)c|d)")
  </code></pre>
  
  <p>this regex matches bd and abc. It does not match bc.</p>
  
  <p>any ideas? thanks.</p>
  
  <p>ok i need to write regex to match next 4 strings: </p>
  
  <pre><code>*date date* date date1*date2
  </code></pre>
  
  <p>should not match:</p>
  
  <pre><code>*date* date1*date2* *date1*date2 date** ...
  </code></pre>
  
  <p>but this should be done with single matching, not several.</p>
  
  <p>please do not post answer like:</p>
  
  <pre><code>(date*date)|(*date)|(date*)|(date)
  </code></pre>