Possible Duplicate:
How to parse HTML with PHP?
I would be most grateful if a regex master among you would be kind enough to help me.
I'd like to make a php function that converts html tags/elements, as per the following:
I want to convert
<span class="heading1">Any generic text, or other html elements such as <p> tags</p> in here</span>
To
<h1 class="heading1">Any text, or other html elements such as <p> tags</p> in here</h1>
...So basically I want to convert the span headings to proper h1 tags (this is for the purpose of better SEO) but there could be other normal span tags that I want to preserve.
Any ideas? Thanks in advance.