1 2 3 4 5 6 7 8 9 10
| //Transform URL and e-mails into links
$texte = eregi_replace(
"(^|[ \t\r\n\(:,]+)?". //punctuation before URL
//Protocole
"((ftp|http|https|gopher|mailto|pop|smtp|news|nntp|telnet|wais|".
"file|imap|prospero|peercast|ed2k|irc|aim|mime|ftam|pnm|rtsp|ldap):".
"[A-Za-z0-9/](([A-Za-z0-9$|.+!*()\.,;/?:@&~=_-])|%[A-Fa-f0-9]{2})+".
"[A-Za-z0-9/&#=_-]+)". //valid chars at the end of an URL
"([\.\),:;? \t\r\n]+([^A-Za-z0-9/&%#=_-]|$))?", //punctuation not followed by valid char
"\\1<a href='\\2' target=\"blank\">\\2</a>\\6", $texte); |