]> git.mxchange.org Git - friendica.git/commitdiff
Fix autolinker regular expression to match test data
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 9 Mar 2019 15:18:14 +0000 (10:18 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 9 Mar 2019 15:20:57 +0000 (10:20 -0500)
src/Content/Text/BBCode.php

index 85466b50f695c7439f7e499267739006f6d4560f..2c324a43304b8d6430f364086cd9d5e8c61c7ef9 100644 (file)
@@ -1275,20 +1275,15 @@ class BBCode extends BaseObject
 (                       # Capture 1: entire matched URL
   https?://                 # http or https protocol
   (?:
-    www\d{0,3}[.]           # "www.", "www1.", "www2." … "www999."
-    |                           #   or
-    [a-z0-9.\-]+[.][a-z]{2,4}/  # looks like domain name followed by a slash
+    [^/.][^/]+[.][^/]+/?    # 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
-  )+
-  (?:                       # End with:
-    \(([^\s()<>]+|(\([^\s()<>]+\)))*\)  # balanced parens, up to 2 levels
     |                               #   or
     [^\s`!()\[\]{};:\'".,<>?«»“”‘’]        # not a space or one of these punct chars
-  )
+  )*
 )@';
                        $text = preg_replace($autolink_regex, '[url]$1[/url]', $text);
                        if ($simple_html == 7) {