New domain regexp for WebFinger matching.

This commit is contained in:
Mikael Nordfeldth 2017-04-22 10:51:03 +02:00
parent 3453521c9c
commit 64b72a3c9b

View File

@ -287,7 +287,7 @@ class OStatusPlugin extends Plugin
$wmatches = array(); $wmatches = array();
// Webfinger matches: @user@example.com or even @user--one.george_orwell@1984.biz // Webfinger matches: @user@example.com or even @user--one.george_orwell@1984.biz
if (preg_match_all('!(?:^|\s+)@((?:\w+[\w\-\_\.]?)*(?:[\w\-\_\.]*\w+)@(?:\w+\-?\w+\.)*\w+(?:\w+\-\w+)*\.\w+)!', if (preg_match_all('/(?:^|\s+)@((?:\w+[\w\-\_\.]?)*(?:[\w\-\_\.]*\w+)@(?:(?!-)[A-Za-z0-9\-]{1,63}(?<!-)\.)+[A-Za-z]{2,10})/',
$text, $text,
$wmatches, $wmatches,
PREG_OFFSET_CAPTURE)) { PREG_OFFSET_CAPTURE)) {