title: regex remove first occurence and first next
body: <p>Hi search the regex version of this code :</p>
  
  <pre><code>$val = '&lt;label for="A" &gt;A&lt;/label&gt;&lt;label for="B"&gt;&lt;div&gt;X&lt;/div&gt;&lt;/label&gt;&lt;label for="C"&gt;&lt;div&gt;Y&lt;/div&gt;&lt;/label&gt;';           
              $firstLabelPos = strpos($val,'&lt;label for="B"&gt;');
              $sideB = substr($val,$firstLabelPos + strlen('&lt;label for="B"&gt;') );
              $firstLabelPos2 = strpos($sideB,'&lt;/label&gt;');
              $result =   substr($val,0,$firstLabelPos-1)
                          .substr($sideB,0,$firstLabelPos2)
                          .substr($sideB,$firstLabelPos2+strlen('&lt;/label&gt;'));
  
  
  result : &lt;label for="A" &gt;A&lt;/label&lt;div&gt;X&lt;/div&gt;&lt;label for="C"&gt;&lt;div&gt;Y&lt;/div&gt;&lt;/label&gt;
  </code></pre>
  
  <p>The code find <code>&lt;label for="B"&gt;</code> and the closest <code>&lt;/label&gt;</code>. Make a new string with what was before, inside and after.</p>
  
  <hr>
  
  <p>Its how to remove the label around a div by the "for" attribute.
  Or you can say, how to remove the first occurrence of <code>&lt;label for="B"&gt;</code> and the closest occurrence of <code>&lt;/label&gt;</code>.</p>
  
  <p>If you can also make sur that we dont touch what is inside the <code>&lt;label...&lt;/label&gt;</code> (could be another label). That will be appreciate for further practice.</p>