From 85c66de520c3bfd588113b9ce79ac85b557d09f3 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sun, 4 Nov 2012 19:52:06 +0100 Subject: [PATCH] Added wcfEscapeRegExp function --- wcfsetup/install/files/js/WCF.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index ff89967eef..09617814e0 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -125,6 +125,16 @@ $.extend(true, { } return $length; + }, + + /** + * Quotes regular expression characters. + * + * @param string string + * @return string + */ + wcfEscapeRegExp: function(string) { + return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); } }); -- 2.20.1