+( # Capture 1: entire matched URL
+ ' . self::linkRegEx() . '
+)@xiu';
+ }
+
+ /**
+ * Returns the regular expression string to match only an HTTP URL
+ *
+ * @return string
+ */
+ public static function onlyLinkRegEx(): string
+ {
+ return '@^' . self::linkRegEx() . '$@xiu';
+ }
+
+ /**
+ * @return string
+ * @see https://daringfireball.net/2010/07/improved_regex_for_matching_urls
+ */
+ private static function linkRegEx(): string
+ {
+ return 'https?:// # http or https protocol