]> git.mjollnir.org Git - moodle.git/commitdiff
Better regular expresssion for detecting URLs at the very start of a text.
authormoodler <moodler>
Wed, 26 Mar 2003 07:33:26 +0000 (07:33 +0000)
committermoodler <moodler>
Wed, 26 Mar 2003 07:33:26 +0000 (07:33 +0000)
I don't know what the old one thought it was doing!  :-)

lib/weblib.php

index 4b80b03de0562aeb211a27a9d98eba3b2173bbf8..987670207d2d44a0e466572bc32b73ab2d06ae5b 100644 (file)
@@ -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<A HREF=\"\\2://\\3\\4\" TARGET=\"newpage\">\\2://\\3\\4</A>", $text);
 
 /// eg www.moodle.com