Return to Snippet

Revision: 40824
at February 8, 2011 15:33 by adampatterson


Initial Code
// $subject contains a body of text with non html URLs
$text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\">\\0</a>", $subject);

Initial URL
http://www.adampatterson.ca/blog/2011/02/regular-expression-for-url-using-ereg_replace/

Initial Description

                                

Initial Title
Regular Expression for URLs using ereg_replace

Initial Tags
regex, url, php, html

Initial Language
PHP