I wrote a little function to put anchor tags around a URL. We're using it to make URL's in paragraphs of text linkable:

function link_the_links($s) {
        return preg_replace('@(http://[^\s]+)@sm', '<a href="$1">$1</a>', $s);
}

Its only flaw (besides a goofy name) is that if a link comes at the end of a sentence, right before the period, the period ends up in the link, thus breaking the link. I've got to somehow ignore the trailing period if it is present.

Any ideas?

Richard K Miller

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to