]> git.mxchange.org Git - friendica.git/commitdiff
Remove new lines from domain name part of autolinker regular expression in Util\Strings
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 11 Mar 2019 18:37:56 +0000 (14:37 -0400)
committerGitHub <noreply@github.com>
Mon, 11 Mar 2019 18:37:56 +0000 (14:37 -0400)
- Fixes issue where the autolinker would include the next paragraph is a pathless URL was followed by new lines.

src/Util/Strings.php

index 3edc9ba90683959fcd685208a62b24b6c18bdfab..681edb1c87711d8ae6d6f9cb84e4e076f86a7c9c 100644 (file)
@@ -358,17 +358,17 @@ class Strings
                return '@(?xi)
 (?<![=\'\]"/])          # Not preceded by [, =, \', ], ", /
 \b
-(                       # Capture 1: entire matched URL
-  https?://                 # http or https protocol
+(                              # Capture 1: entire matched URL
+  https?://                            # http or https protocol
   (?:
-    [^/.][^/]+[.][^/]+/?    # looks like domain name followed by a slash
+    [^/\s.][^/\s]+[.][^\s/]+/?         # looks like domain name followed by a slash
   )
-  (?:                       # One or more:
-    [^\s()<>]+                  # Run of non-space, non-()<>
-    |                           #   or
-    \(([^\s()<>]+|(\([^\s()<>]+\)))*\)  # balanced parens, up to 2 levels
-    |                               #   or
-    [^\s`!()\[\]{};:\'".,<>?«»“”‘’]        # not a space or one of these punct chars
+  (?:                                  # One or more:
+    [^\s()<>]+                         # Run of non-space, non-()<>
+    |                                  #   or
+    \(([^\s()<>]+|(\([^\s()<>]+\)))*\) # balanced parens, up to 2 levels
+    |                                  #   or
+    [^\s`!()\[\]{};:\'".,<>?«»“”‘’]    # not a space or one of these punct chars
   )*
 )@';
        }