summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-11-05 19:08:31 -0700
committerRich Trott <rtrott@gmail.com>2016-11-09 16:40:38 -0800
commit7ef16eee2f0b69a2e5004f249cb4ebeb7000733e (patch)
treee70c0bc506e111e4ed4ef20ce1b9a9d7c27de246
parent4aca347527fecab0a394cc39ffdf75c76c794fe5 (diff)
downloadandroid-node-v8-7ef16eee2f0b69a2e5004f249cb4ebeb7000733e.tar.gz
android-node-v8-7ef16eee2f0b69a2e5004f249cb4ebeb7000733e.tar.bz2
android-node-v8-7ef16eee2f0b69a2e5004f249cb4ebeb7000733e.zip
lib,test: remove unneeded escaping of /
The `/` character does not need to be escaped when occurring inside a character class in a regular expression. Remove such instances of escaping in the code base. PR-URL: https://github.com/nodejs/node/pull/9485 Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
-rw-r--r--lib/fs.js8
-rw-r--r--lib/url.js2
-rw-r--r--test/debugger/test-debugger-repl-break-in-module.js6
-rw-r--r--test/parallel/test-require-json.js2
4 files changed, 9 insertions, 9 deletions
diff --git a/lib/fs.js b/lib/fs.js
index 1f4def2725..eb91b1d5c4 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -1444,13 +1444,13 @@ fs.unwatchFile = function(filename, listener) {
// Regexp that finds the next portion of a (partial) path
// result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
const nextPartRe = isWindows ?
- /(.*?)(?:[\/\\]+|$)/g :
- /(.*?)(?:[\/]+|$)/g;
+ /(.*?)(?:[/\\]+|$)/g :
+ /(.*?)(?:[/]+|$)/g;
// Regex to find the device root, including trailing slash. E.g. 'c:\\'.
const splitRootRe = isWindows ?
- /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/ :
- /^[\/]*/;
+ /^(?:[a-zA-Z]:|[\\/]{2}[^\\/]+[\\/][^\\/]+)?[\\/]*/ :
+ /^[/]*/;
function encodeRealpathResult(result, options, err) {
if (!options || !options.encoding || options.encoding === 'utf8' || err)
diff --git a/lib/url.js b/lib/url.js
index 201ebfedcc..a199f4b581 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -204,7 +204,7 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
// user@server is *always* interpreted as a hostname, and url
// resolution will treat //foo/bar as host=foo,path=bar because that's
// how the browser resolves relative URLs.
- if (slashesDenoteHost || proto || /^\/\/[^@\/]+@[^@\/]+/.test(rest)) {
+ if (slashesDenoteHost || proto || /^\/\/[^@/]+@[^@/]+/.test(rest)) {
var slashes = rest.charCodeAt(0) === 47/*/*/ &&
rest.charCodeAt(1) === 47/*/*/;
if (slashes && !(proto && hostlessProtocol[proto])) {
diff --git a/test/debugger/test-debugger-repl-break-in-module.js b/test/debugger/test-debugger-repl-break-in-module.js
index d855dc64f4..91782ae6e3 100644
--- a/test/debugger/test-debugger-repl-break-in-module.js
+++ b/test/debugger/test-debugger-repl-break-in-module.js
@@ -20,7 +20,7 @@ repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [
// continue - the breakpoint should be triggered
repl.addTest('c', [
- /break in .*[\\\/]mod\.js:2/,
+ /break in .*[\\/]mod\.js:2/,
/1/, /2/, /3/, /4/
]);
@@ -42,7 +42,7 @@ repl.addTest('restart', [].concat(
// continue - the breakpoint should be triggered
repl.addTest('c', [
- /break in .*[\\\/]mod\.js:2/,
+ /break in .*[\\/]mod\.js:2/,
/1/, /2/, /3/, /4/
]);
@@ -53,7 +53,7 @@ repl.addTest('cb("mod.js", 2)', [
]);
repl.addTest('c', [
- /break in .*[\\\/]main\.js:4/,
+ /break in .*[\\/]main\.js:4/,
/2/, /3/, /4/, /5/, /6/
]);
diff --git a/test/parallel/test-require-json.js b/test/parallel/test-require-json.js
index be9f5f0aaa..75cdb98855 100644
--- a/test/parallel/test-require-json.js
+++ b/test/parallel/test-require-json.js
@@ -6,7 +6,7 @@ var assert = require('assert');
try {
require(path.join(common.fixturesDir, 'invalid.json'));
} catch (err) {
- var re = /test[\/\\]fixtures[\/\\]invalid.json: Unexpected string/;
+ var re = /test[/\\]fixtures[/\\]invalid.json: Unexpected string/;
var i = err.message.match(re);
assert.notStrictEqual(null, i, 'require() json error should include path');
}