-3

I have the below piece of html which is PHP generated, I would like to be able to remove everything between these two pieces of strings <p and p&gt

<li class="level1 nav-2-1 first">
    <a href="http://dev.example.com/women/"><span>Women &lt;p style=&quot;color:#73bf43;display: inline-block;font-size: 10px;&quot;&gt;- NEW&lt;/p&gt;</span></a>
</li>
<li class="level1 nav-2-2">
    <a href="http://dev.example.com/men"><span>Men&lt;p style=&quot;color: #73bf43; display: inline-block; font-size: 10px;&quot;&gt;- &lt;strong&gt;NEW&lt;/strong&gt;&lt;/p&gt;</span></a>
</li>

So far I've tried variations of the below:

preg_replace('/&lt.*?\p&gt|\s*/', '', $_input)

Where $_input is the string of html above.

Holly
  • 7,462
  • 23
  • 86
  • 140

1 Answers1

1

Try this

$replaced = preg_replace('/&lt;p.*?p&gt;/', '', $data);
Harald Nordgren
  • 11,693
  • 6
  • 41
  • 65