]> git.mxchange.org Git - friendica.git/commitdiff
Exclude punctuation from domain in autolinker regular expression
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 17 Mar 2019 23:37:26 +0000 (19:37 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 17 Mar 2019 23:37:26 +0000 (19:37 -0400)
src/Util/Strings.php

index 681edb1c87711d8ae6d6f9cb84e4e076f86a7c9c..d6583b9c61c0eb29993ee350d2eb2683e3592c3a 100644 (file)
@@ -361,7 +361,10 @@ class Strings
 (                              # Capture 1: entire matched URL
   https?://                            # http or https protocol
   (?:
-    [^/\s.][^/\s]+[.][^\s/]+/?         # looks like domain name followed by a slash
+    [^/\s`!()\[\]{};:\'",<>?«»“”‘’.]    # Domain can\'t start with a . 
+    [^/\s`!()\[\]{};:\'",<>?«»“”‘’]+    # Domain can\'t end with a .
+    \.
+    [^/\s`!()\[\]{};:\'".,<>?«»“”‘’]+/? # Followed by a slash
   )
   (?:                                  # One or more:
     [^\s()<>]+                         # Run of non-space, non-()<>