title: Regex to identify a specific pattern
body: <p>I am writing regex to find a specific pattern in my string. I have to identify if the string satisfy all the pattern that I am looking for. I have following criteria:</p>
  <ol>
  <li>The name should start with either &quot;P&quot; or &quot;Q&quot; or &quot;R&quot;</li>
  <li>Following the first character the string should match either &quot;XYZ&quot; or &quot;ABCD&quot;</li>
  <li>If the XYZ is present then the 8th character should either be &quot;H&quot; or &quot;D&quot;, if &quot;ABCD&quot; is present the 9th character should be either &quot;H&quot; or &quot;D&quot;.</li>
  </ol>
  <p>String could be:</p>
  <pre><code>PXYZ****H***** -&gt; Should be true
  QABCD****H***** -&gt; Should be true
  AXYG****Z***** -&gt; Should be false
  RABCD****H=D***** -&gt; Should be true
  </code></pre>
  <p>I have tried if the string starts with <code>([P|Q|R])\w+</code>, not sure how to combine others.</p>