Skip to content

Commit a8909b8

Browse files
TrottMylesBorins
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 Ref: #9749 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James Snell <[email protected]>
1 parent 70062f7 commit a8909b8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/_tls_wrap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ Server.prototype.addContext = function(servername, context) {
936936
}
937937

938938
var re = new RegExp('^' +
939-
servername.replace(/([\.^$+?\-\\[\]{}])/g, '\\$1')
939+
servername.replace(/([.^$+?\-\\[\]{}])/g, '\\$1')
940940
.replace(/\*/g, '[^.]*') +
941941
'$');
942942
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
let 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)