Simplify consecutive repetition operators in FileUtil::LINK_REGEX
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 7 Sep 2023 12:36:28 +0000 (14:36 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 7 Sep 2023 12:36:28 +0000 (14:36 +0200)
This appeared with the previous commit and cause useless backtracking.

wcfsetup/install/files/lib/util/FileUtil.class.php

index c1cba09edaf0cccc9bd6df83b71e60513df17d92..25347d55a8a66a07e0d7f6bc77ce36d3517b0976 100644 (file)
@@ -35,7 +35,7 @@ final class FileUtil
     /**
      * A regular expression that allows to detect links within text.
      */
-    public const LINK_REGEX = "#(?i)\\b((?:https?://|www\\d{0,3}[.]|(?:[a-z0-9\\-]+[.])+[a-z]{2,4}/)(?:[^\\s()<>]+|\\((?:[^\\s()<>]+)*\\))+(?:\\((?:[^\\s()<>]+)*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))#iS";
+    public const LINK_REGEX = "#(?i)\\b((?:https?://|www\\d{0,3}[.]|(?:[a-z0-9\\-]+[.])+[a-z]{2,4}/)(?:[^\\s()<>]+|\\((?:[^\\s()<>])*\\))+(?:\\((?:[^\\s()<>])*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))#iS";
 
     /**
      * Prepares the temporary folder and returns its path.