Skip to content

Commit 44792f8

Browse files
Trottevanlucas
authored andcommitted
benchmark,lib,test,tools: remove unneeded . escape
The `.` character does not need to be escaped when it appears inside a regular expression character class. This removes instances of unnecessary escapes of the `.` character. This also removes a few unnecessary escapes of the `(` and `)` characters within character classes too. PR-URL: #9449 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Minwoo Jung <jmwsoft@gmail.com> Reviewed-By: James Snell <jasnell@gmail.com>
1 parent b083086 commit 44792f8

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

benchmark/_http-benchmarkers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ AutocannonBenchmarker.prototype.processResults = function(output) {
3737

3838
function WrkBenchmarker() {
3939
this.name = 'wrk';
40-
this.regexp = /Requests\/sec:[ \t]+([0-9\.]+)/;
40+
this.regexp = /Requests\/sec:[ \t]+([0-9.]+)/;
4141
const result = child_process.spawnSync('wrk', ['-h']);
4242
this.present = !(result.error && result.error.code === 'ENOENT');
4343
}

lib/_tls_wrap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ Server.prototype.addContext = function(servername, context) {
919919
}
920920

921921
var re = new RegExp('^' +
922-
servername.replace(/([\.^$+?\-\\[\]{}])/g, '\\$1')
922+
servername.replace(/([.^$+?\-\\[\]{}])/g, '\\$1')
923923
.replace(/\*/g, '[^.]*') +
924924
'$');
925925
this._contexts.push([re, tls.createSecureContext(context).context]);

test/parallel/test-repl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function error_test() {
7272
if (read_buffer !== client_unix.expect) {
7373
var expect = client_unix.expect;
7474
if (expect === prompt_multiline)
75-
expect = /[\.]{3} /;
75+
expect = /[.]{3} /;
7676
assert.ok(read_buffer.match(expect));
7777
console.error('match');
7878
}

tools/doc/json.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -545,12 +545,12 @@ function deepCopy_(src) {
545545
// these parse out the contents of an H# tag
546546
var eventExpr = /^Event(?::|\s)+['"]?([^"']+).*$/i;
547547
var classExpr = /^Class:\s*([^ ]+).*?$/i;
548-
var propExpr = /^(?:property:?\s*)?[^\.]+\.([^ \.\(\)]+)\s*?$/i;
549-
var braceExpr = /^(?:property:?\s*)?[^\.\[]+(\[[^\]]+\])\s*?$/i;
548+
var propExpr = /^(?:property:?\s*)?[^.]+\.([^ .()]+)\s*?$/i;
549+
var braceExpr = /^(?:property:?\s*)?[^.\[]+(\[[^\]]+\])\s*?$/i;
550550
var classMethExpr =
551-
/^class\s*method\s*:?[^\.]+\.([^ \.\(\)]+)\([^\)]*\)\s*?$/i;
551+
/^class\s*method\s*:?[^.]+\.([^ .()]+)\([^)]*\)\s*?$/i;
552552
var methExpr =
553-
/^(?:method:?\s*)?(?:[^\.]+\.)?([^ \.\(\)]+)\([^\)]*\)\s*?$/i;
553+
/^(?:method:?\s*)?(?:[^.]+\.)?([^ .()]+)\([^)]*\)\s*?$/i;
554554
var newExpr = /^new ([A-Z][a-zA-Z]+)\([^\)]*\)\s*?$/;
555555
var paramExpr = /\((.*)\);?$/;
556556

0 commit comments

Comments
 (0)