diff options
author | portix <none@none> | 2013-02-16 13:51:03 +0100 |
---|---|---|
committer | portix <none@none> | 2013-02-16 13:51:03 +0100 |
commit | e0061a63ef72294326f4b6f2e3a0ba3018ec2a50 (patch) | |
tree | 4cc5e8d62b218cd6907610c475142ad33b6b9cdb /scripts | |
parent | 83a2d7ac01dba24e03f990632e25b3346fa48439 (diff) | |
download | dwb-e0061a63ef72294326f4b6f2e3a0ba3018ec2a50.zip |
Implementing RegExp.escape
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/util.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/lib/util.js b/scripts/lib/util.js index 3cb950b3..312e7472 100644 --- a/scripts/lib/util.js +++ b/scripts/lib/util.js @@ -113,4 +113,14 @@ } }); } + if (! RegExp.escape) + { + Object.defineProperty(RegExp, "escape", + { + value : function(string) + { + return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + } + }); + } })(); |