Improve & optimize regex detection

Fixes #229
This commit is contained in:
Matthias Mullie 2018-01-08 10:47:50 +01:00
parent 023c6bfb19
commit cb1450437c
2 changed files with 10 additions and 1 deletions

View File

@ -238,7 +238,7 @@ class JS extends Minify
// closing the regex)
// then also ignore bare `/` inside `[]`, where they don't need to be
// escaped: anything inside `[]` can be ignored safely
$pattern = '\\/([^\\[\\/\\\\]*+|(\\\\.)*+|\\[([^\\]\\\\]|\\\\.)*\\])+\\/[gimy]*';
$pattern = '\\/(?:[^\\[\\/\\\\]+|(?:\\\\.)+|(?:\\[(?:[^\\]\\\\]+|(?:\\\\.)+)+\\])+)++\\/[gimy]*';
// a regular expression can only be followed by a few operators or some
// of the RegExp methods (a `\` followed by a variable or value is

File diff suppressed because one or more lines are too long