Possible Duplicate:
PHP Strip_tags for div with a specific ID?
I have a string that contains two types of span tags. One type has an id that starts with the keyword “junk_”. The other type, however has some random ids. What I want to do is to use preg_replace to strip out only the “junk_” span tags and their content. I still want to keep the other spans. Here is the string that I have
<span id="bla">This is a test</span>.
<span id="junk_74">Please</span> remove <span id="junk_75">all</span> junk spans.
The output I want should look like:
<span id="bla">This is a test</span>. remove junk spans.
Any help would be greatly appreciated.
Also see this example.