// "<a href=\"mailto:\\1\">\\1</a>",
// $text);
- $text = preg_replace("/(.*)(http[s]?):\/\/(.*)(\s|$|<|>|\\\|\(|\))(.*)/U",
- "\\1<a href=\"\\2://\\3\">\\3</a>\\4\\5", $text);
+// $text = preg_replace("/(.*)(http[s]?):\/\/(.*)(\s|$|<|>|\\\|\(|\))(.*)/U",
+// "\\1<a href=\"\\2://\\3\">\\3</a>\\4\\5", $text);
- $text = preg_replace('/([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.
- '\@'.'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+)/i',
- "<a href=\"mailto:\\1\">\\1</a>",
+ $text = preg_replace('/(?|<a href="mailto[\s]*:[\s]*([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'\@'
+ .'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+)">(.*)<\/a>'
+ .'|((((([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'\@'
+ .'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+))))))/i',
+ "<a href=\"mailto:\\1\">\\5</a>",
$text);
return $text;
}