I want to replace all "mailto:" links in html with plain emails.
In: text .... <a href="mailto:[email protected]">not needed</a> text
Out: text .... [email protected] text
I did this:
$str = preg_replace("/\<a.+href=\"mailto:(.*)\".+\<\/a\>/", "$1", $str);
But it fails if there are multiple emails in string or html inside "a" tag
In: <a href="mailto:[email protected]">not needed</a><a href="mailto:[email protected]"><font size="3">[email protected]</font></a>
Out: [email protected]">