Skip to content

Commit

Permalink
To identify coorect end of the regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Chhandak.Barua authored and tedivm committed Jun 19, 2023
1 parent 962daa7 commit 70b18f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/JShrink/Minifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ protected function saveRegex()
$this->echo($this->b);

while (($this->a = $this->getChar()) !== false) {
if ($this->a === '/' && (preg_match('/g|\n|i|\.|,|\s/', $this->peek()) === 1)) {
if ($this->a === '/' && (preg_match('/g|\n|i|\)|\.|,|\s/', $this->peek()) === 1)) {
break;
}

Expand Down
5 changes: 1 addition & 4 deletions tests/Resources/jshrink/output/regex_close.js
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
function test(string){return(string||'').replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,
'\\$1'
)
}
function test(string){return(string||'').replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,'\\$1')}

0 comments on commit 70b18f1

Please sign in to comment.