title: Php regex matches html tags contain a certain class name
body: <p>I need a regular expression matches any tags have classname "share"</p>
  
  <p>I think I'm very close. with this:</p>
  
  <pre><code>class=".*share.*"
  </code></pre>
  
  <p>I want it to match these:</p>
  
  <pre><code>&lt;div class="share"&gt;&lt;/div&gt;
  &lt;div class="sdfsd share sdfsdfsdf"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>But not these:</p>
  
  <pre><code>&lt;div class="sdfsd dfdgdg" share&gt;&lt;/div&gt;
  &lt;a class="icon-share export-to-csv-button"/&gt;
  &lt;a class="fxac link" href="/share"/&gt;
  </code></pre>
  
  <p>Please visit: <a href="https://regex101.com/r/uU6dU0/2" rel="nofollow">https://regex101.com/r/uU6dU0/2</a></p>