diff --git a/src/JShrink/Minifier.php b/src/JShrink/Minifier.php index 9e6c781..365c474 100644 --- a/src/JShrink/Minifier.php +++ b/src/JShrink/Minifier.php @@ -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; } diff --git a/tests/Resources/jshrink/output/regex_close.js b/tests/Resources/jshrink/output/regex_close.js index 4f80faf..fb0880d 100644 --- a/tests/Resources/jshrink/output/regex_close.js +++ b/tests/Resources/jshrink/output/regex_close.js @@ -1,4 +1 @@ -function test(string){return(string||'').replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, - '\\$1' - ) -} +function test(string){return(string||'').replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,'\\$1')} \ No newline at end of file