Would like to remove any attribute within html tags and I think this can be achieved using regex but I'm not good at using regex.
Tried working with str_replace but it's just not the right way to go. And I've searched for questions similar to this but could not find any.
Example:
Got html tags like this within a variable:
$str = '
<p class="class_style" style="font-size: medium; line-height: normal; letter-spacing: normal;">content</p>
<span class="another_class_style" style="font-size: medium; line-height: normal; letter-spacing: normal;">content</span>
<ul class="another_class_style" style="background:#006;"></ul>
<li class="another_class_style" style=" list-style:circle; color:#930;">content</li>';
Call to certain preg_match()
$new_str = preg_match('', $str)
Expected Output:
$new_str = '
<p>content</p>
<span>content</span>
<ul></ul>
<li>content</li>';
Pls note that I dont intend to strip off the html tags, rather i just need to remove any tag elements within the tags.
php strip_tags() isn't an option
Would be grateful getting help with this.