From: Marcel Werk Date: Sun, 4 Nov 2012 18:52:06 +0000 (+0100) Subject: Added wcfEscapeRegExp function X-Git-Tag: 2.0.0_Beta_1~822 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=85c66de520c3bfd588113b9ce79ac85b557d09f3;p=GitHub%2FWoltLab%2FWCF.git Added wcfEscapeRegExp function --- 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, '\\$&'); } });