Added wcfEscapeRegExp function
authorMarcel Werk <burntime@woltlab.com>
Sun, 4 Nov 2012 18:52:06 +0000 (19:52 +0100)
committerMarcel Werk <burntime@woltlab.com>
Sun, 4 Nov 2012 18:52:06 +0000 (19:52 +0100)
wcfsetup/install/files/js/WCF.js

index ff89967eef33695e357a25353093a91a51ff4ad5..09617814e0a7e4387a886c1060239b94fbb14c3b 100755 (executable)
@@ -125,6 +125,16 @@ $.extend(true, {
                }
 
                return $length;
+       },
+       
+       /**
+        * Quotes regular expression characters.
+        * 
+        * @param       string          string
+        * @return      string
+        */
+       wcfEscapeRegExp: function(string) {
+           return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
        }
 });