Page 1 of 1

preg_match help!

Posted: Tue Jun 09, 2009 11:26 pm
by revbackup
If I have a variable like this:

Code: Select all

 
$html = '<td>
<span onmouseover="_tipon(this)" onmouseout="_tipoff()">
<span class="google-src-text" style="direction: ltr; text-align: left">
1206732400OWYJ
</span>
1206732400OWYJ
</span></td>';
 
and I want to remove the one in red text so that the new variable would contain

Code: Select all

 
$html = '<td>
<span onmouseover="_tipon(this)" onmouseout="_tipoff()">
1206732400OWYJ
</span></td>';
 
How could I possibly do that.??.. I think a preg_match can possibly make it, but I don't know the code and
I dont know that much about preg_match.... Please help me with this... thanks! :D

Re: preg_match help!

Posted: Tue Jun 09, 2009 11:29 pm
by requinix
If you have valid HTML and all the opening/closing tags - which you do - use DOMDocument to remove nodes. It's like using JavaScript.