diff --git a/source/Ox/js/RegExp.js b/source/Ox/js/RegExp.js index ff35beb6..1314c27c 100644 --- a/source/Ox/js/RegExp.js +++ b/source/Ox/js/RegExp.js @@ -4,10 +4,10 @@ Ox.escapeRegExp Escapes a string for use in a regular expression str String > Ox.escapeRegExp('foo.com/bar?baz') 'foo\\.com\\/bar\\?baz' - > new RegExp(Ox.escapeRegExp('foo.com/bar?baz')).test('foo.com/bar?baz') + > new RegExp(Ox.escapeRegExp('/\\^$*+?.-|(){}[]')).test('/\\^$*+?.-|(){}[]') true @*/ // see https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions Ox.escapeRegExp = function(string) { - return (string + '').replace(/([\/\\\^\$\*\+\?\.\-\|\(\)\{\}\[\]])/g, '\\$1'); + return (string + '').replace(/([\/\\^$*+?.\-|(){}[\]])/g, '\\$1') }; \ No newline at end of file