Skip to content

Commit

Permalink
Improve regex detection
Browse files Browse the repository at this point in the history
Fixes #249
Fixes #252
Fixes #253
  • Loading branch information
matthiasmullie committed Nov 26, 2018
1 parent 14fb0ed commit cc0eb0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/JS.php
Expand Up @@ -238,7 +238,7 @@ protected function extractRegex()
// closing the regex)
// then also ignore bare `/` inside `[]`, where they don't need to be
// escaped: anything inside `[]` can be ignored safely
$pattern = '\\/(?:[^\\[\\/\\\\\n\r]+|(?:\\\\.)+|(?:\\[(?:[^\\]\\\\\n\r]+|(?:\\\\.)+)+\\])+)++\\/[gimuy]*';
$pattern = '\\/(?!\*)(?:[^\\[\\/\\\\\n\r]++|(?:\\\\.)++|(?:\\[(?:[^\\]\\\\\n\r]++|(?:\\\\.)++)++\\])++)++\\/[gimuy]*';

// 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
Expand Down

0 comments on commit cc0eb0c

Please sign in to comment.