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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James Snell <[email protected]>
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‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ AutocannonBenchmarker.prototype.processResults = function(output){
3737

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

‎lib/_tls_wrap.js‎

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

921921
varre=newRegExp('^'+
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‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function error_test(){
7272
if(read_buffer!==client_unix.expect){
7373
varexpect=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‎

Lines changed: 4 additions & 4 deletions
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
vareventExpr=/^Event(?::|\s)+['"]?([^"']+).*$/i;
547547
varclassExpr=/^Class:\s*([^]+).*?$/i;
548-
varpropExpr=/^(?:property:?\s*)?[^\.]+\.([^\.\(\)]+)\s*?$/i;
549-
varbraceExpr=/^(?:property:?\s*)?[^\.\[]+(\[[^\]]+\])\s*?$/i;
548+
varpropExpr=/^(?:property:?\s*)?[^.]+\.([^.()]+)\s*?$/i;
549+
varbraceExpr=/^(?:property:?\s*)?[^.\[]+(\[[^\]]+\])\s*?$/i;
550550
varclassMethExpr=
551-
/^class\s*method\s*:?[^\.]+\.([^\.\(\)]+)\([^\)]*\)\s*?$/i;
551+
/^class\s*method\s*:?[^.]+\.([^.()]+)\([^)]*\)\s*?$/i;
552552
varmethExpr=
553-
/^(?:method:?\s*)?(?:[^\.]+\.)?([^\.\(\)]+)\([^\)]*\)\s*?$/i;
553+
/^(?:method:?\s*)?(?:[^.]+\.)?([^.()]+)\([^)]*\)\s*?$/i;
554554
varnewExpr=/^new([A-Z][a-zA-Z]+)\([^\)]*\)\s*?$/;
555555
varparamExpr=/\((.*)\);?$/;
556556

0 commit comments

Comments
(0)