Hey,
Ok using the following little snippet to replace <a href"www">www</a> links in html to plain text links - this is for a mailing list.
$mail_format = str_replace("\r", "", $message2);
$mail_format = stripslashes($mail_format);
$mail_format = preg_replace("/<a href=\"(.*)\">(.*)<\/a>/i", "\\2 (\\1)", $mail_format);
$main = strip_tags($mail_format);
It's the third bit of the code, the preg_replace function that seems to be doing some odd stuff.
For example, if I have the following code:
Links - <a href="http://www.google.com">Google</a> or <a href="http://www.yahoo.com">Yahoo</a>.
I get this in my plain text emails using the above PHP:
Links - Yahoo ([url]http://www.google.com[/url]">Google or
If I put a break after "or" I get perfect links:
Links - Google ([url]http://www.google.com[/url]) or
Yahoo ([url]http://www.yahoo.com[/url]).
It seems as though when the two <a href> links are on the same line, it messes up the code?
Any ideas?
Cheers,
Chris