From: moodler Date: Wed, 26 Mar 2003 07:33:26 +0000 (+0000) Subject: Better regular expresssion for detecting URLs at the very start of a text. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=075a59165658188a065434668a9de789afe2718b;p=moodle.git Better regular expresssion for detecting URLs at the very start of a text. I don't know what the old one thought it was doing! :-) --- diff --git a/lib/weblib.php b/lib/weblib.php index 4b80b03de0..987670207d 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -524,7 +524,7 @@ function text_to_html($text, $smiley=true, $para=true) { $text = eregi_replace(">([\n\r])", "> ", $text); /// Make lone URLs into links. eg http://moodle.com/ - $text = eregi_replace("([\n\r ([])([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", + $text = eregi_replace("([[:space:]]|^)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1\\2://\\3\\4", $text); /// eg www.moodle.com