wrap multiline regexp in quotes so it doesn't mess up my editor's indenting
This commit is contained in:
parent
a845d06c77
commit
99773e3b5e
28
lib/util.php
28
lib/util.php
@ -394,20 +394,20 @@ function common_render_text($text)
|
|||||||
|
|
||||||
function common_replace_urls_callback($text, $callback) {
|
function common_replace_urls_callback($text, $callback) {
|
||||||
// Start off with a regex
|
// Start off with a regex
|
||||||
$regex = '#
|
$regex = '#'.
|
||||||
(?:
|
'(?:'.
|
||||||
(?:
|
'(?:'.
|
||||||
(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|xmpp|irc)://
|
'(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|xmpp|irc)://'.
|
||||||
|
|
'|'.
|
||||||
(?:mailto|aim|tel):
|
'(?:mailto|aim|tel):'.
|
||||||
)
|
')'.
|
||||||
[^.\s]+\.[^\s]+
|
'[^.\s]+\.[^\s]+'.
|
||||||
|
|
'|'.
|
||||||
(?:[^.\s/:]+\.)+
|
'(?:[^.\s/:]+\.)+'.
|
||||||
(?:museum|travel|[a-z]{2,4})
|
'(?:museum|travel|[a-z]{2,4})'.
|
||||||
(?:[:/][^\s]*)?
|
'(?:[:/][^\s]*)?'.
|
||||||
)
|
')'.
|
||||||
#ix';
|
'#ix';
|
||||||
preg_match_all($regex, $text, $matches);
|
preg_match_all($regex, $text, $matches);
|
||||||
|
|
||||||
// Then clean up what the regex left behind
|
// Then clean up what the regex left behind
|
||||||
|
Loading…
Reference in New Issue
Block a user