From: Mikael Nordfeldth <mmn@hethane.se>
Date: Sat, 22 Apr 2017 08:51:03 +0000 (+0200)
Subject: New domain regexp for WebFinger matching.
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0fd83f0028892ae7257c59ec6e0cd01fe5c9a1a2;p=quix0rs-gnu-social.git

New domain regexp for WebFinger matching.
---

diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index 3e9a0c58d6..d5233afc80 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -271,7 +271,7 @@ class OStatusPlugin extends Plugin
 
         $wmatches = array();
         // 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,
                        $wmatches,
                        PREG_OFFSET_CAPTURE)) {