I have a title=""
attribute in an anchor that contains HTML. I'm trying to remove the title attribute entirely but for whatever reason the preg replace I'm using will not work. I've tried:
$output = preg_replace( '/title=\"(.*?)\"/', '', $output );
$output = preg_replace( '/\title="(.*?)"/', '', $output );
$output = preg_replace( '` title="(.+)"`', '', $output );
None of the above works, but I can use something like:
$output = str_replace( 'title', 'class', $output );
Just to prove that I was able to do something ( and I wasn't uploading the wrong file or something ). Output looks like this:
<a href="#" title="<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
<tbody>
<tr>
<td colspan=\"2\" align=\"center\" valign=\"top\"></td>
</tr>
<tr>
<td valign=\"top\" width=\"50%\">
table content
</td>
<td valign=\"top\" width=\"50%\">
table content
</td>
</tr>
</tbody>
</table>">Link Title</a>
So what I'm trying to do is filter $output
and remove the title attribute entirely including everything inside the title attribute. Why will the preg_replace()
above not work and what are my options?