On Thu, Dec 12, 2002 at 11:01:47PM -0800, Troy May wrote:
>
> How would take a regular non-formatted text link (http://www.link.com) and
> turn it into ready to post HTML? (<a
>href=http://www.link.com>http://www.link.com</a>)
>
> Darn, Outlook formats it, but you get the idea. It would just be typed out
> normally.
How about:
$href="(https?://([a-z0-9]+\.)+[a-z][a-z]+/[a-z0-9_./~%-]*)";
$repl="<a href='\\1'>\\1</a>";
$line=eregi_replace($href, $repl, $line);
You can of course make $href less restrictive if you're liberal minded
about your URL formats.
--
Paul Chvostek <[EMAIL PROTECTED]>
Operations / Abuse / Whatever +1 416 598-0000
it.canada - hosting and development http://www.it.ca/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php