title: How can I define a optional part in the pattern?
body: <p>Here is <a href="https://regex101.com/r/D6Qas8/3" rel="nofollow noreferrer">my content</a>:</p>
  
  <pre><code>&lt;div&gt;something&lt;/div&gt;
  &lt;div&gt;something else &lt;p&gt;paragraph&lt;/p&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And this is my pattern:</p>
  
  <pre><code>/&lt;div&gt;([^&lt;]+).*?&lt;\/div&gt;/
  </code></pre>
  
  <p>As you see, it matches just the text content of <code>div</code>. Now I want to add an optional part to the pattern for <code>p</code>. I mean, I want to get <code>p</code>'s value as another capturing group if it exists.</p>
  
  <p>How can I do that?</p>