I want to remove the following - title=\"huluId-581956\" - from a string so that:
<a title=\"huluId-581956\" href="somelink">My Link</a>
becomes
<a href="somelink">My Link</a>
I'm basically looking to take the title attribute out. I finessed my exp on regexpal and put it into preg_replace as such:
$myString ='<a title=\"huluId-581956\" href="somelink">My Link</a>';
$myString = preg_replace('/(title=\\)("huluId-)[0-9]+\\(")/', '', $myString);
$myString = preg_replace('/(title=\\)("huluId-)[0-9]+(\\")/', '', $myString);
But although on regexpal I have no problem selecting the title attribute, when I place the expression into preg_replace it does NOT work.
Any help would be greatly appreciated as I have no idea why this would be so.
Thank you!
$html, but you put the contents in$myString. If not that, maybe too many\. And perhaps you could use an XML parser to pull the attribute out, just in case your<a>is less well behaved in the future?