summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorportix <none@none>2013-02-16 13:51:03 +0100
committerportix <none@none>2013-02-16 13:51:03 +0100
commite0061a63ef72294326f4b6f2e3a0ba3018ec2a50 (patch)
tree4cc5e8d62b218cd6907610c475142ad33b6b9cdb /scripts
parent83a2d7ac01dba24e03f990632e25b3346fa48439 (diff)
downloaddwb-e0061a63ef72294326f4b6f2e3a0ba3018ec2a50.zip
Implementing RegExp.escape
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/util.js10
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, '\\$&');
+ }
+ });
+ }
})();