]> git.mxchange.org Git - friendica.git/commitdiff
bbcode documentation: improved webfinger profile regexp
authorHypolite Petovan <ben.lort@gmail.com>
Mon, 31 Oct 2016 04:00:12 +0000 (00:00 -0400)
committerHypolite Petovan <ben.lort@gmail.com>
Mon, 31 Oct 2016 04:00:12 +0000 (00:00 -0400)
include/bbcode.php

index ed23253648e615e5613893409d24a4865582891a..6d56587ab1bd280c1f7bbceed7990cd3bb579a32 100644 (file)
@@ -892,8 +892,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
        // we may need to restrict this further if it picks up too many strays
        // link acct:user@host to a webfinger profile redirector
 
-       $Text = preg_replace('/acct:(.*?)@(.*?)([ ,])/', '<a href="' . $a->get_baseurl() . '/acctlink?addr=' . "$1@$2"
-               . '" target="extlink" >acct:' . "$1@$2$3" . '</a>',$Text);
+       $Text = preg_replace('/acct:([^@]+)@((?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63})/', '<a href="' . $a->get_baseurl() . '/acctlink?addr=$1@$2" target="extlink">acct:$1@$2</a>',$Text);
 
        // Perform MAIL Search
        $Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1">$1</a>', $Text);