From 85ac21783c11f8ccab06106dba9735a31a86924d Mon Sep 17 00:00:00 2001 From: Rodney Rehm Date: Tue, 27 Dec 2011 13:16:39 +0100 Subject: [PATCH] improving RegExp escaping - via @abozhilov https://twitter.com/abozhilov/status/151636970240614400 --- src/URI.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/URI.js b/src/URI.js index 212454eb..57f1fa9d 100644 --- a/src/URI.js +++ b/src/URI.js @@ -15,7 +15,7 @@ (function(undefined) { function escapeRegEx(string) { - return string.replace(/[$^\.*+?()[\\]{}|]/g, "\\" + "$1"); + return string.replace(/[$^\\.*+?()[\]{}|]/g, "\\$&"); } function isArray(obj) {