Skip to content

Commit 4762aed

Browse files
Improve regex detection
Fixes #249 Fixes #252 Fixes #253
1 parent 6d922d0 commit 4762aed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/JS.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ protected function extractRegex()
238238
// closing the regex)
239239
// then also ignore bare `/` inside `[]`, where they don't need to be
240240
// escaped: anything inside `[]` can be ignored safely
241-
$pattern = '\\/(?:[^\\[\\/\\\\\n\r]+|(?:\\\\.)+|(?:\\[(?:[^\\]\\\\\n\r]+|(?:\\\\.)+)+\\])+)++\\/[gimuy]*';
241+
$pattern = '\\/(?!\*)(?:[^\\[\\/\\\\\n\r]++|(?:\\\\.)++|(?:\\[(?:[^\\]\\\\\n\r]++|(?:\\\\.)++)++\\])++)++\\/[gimuy]*';
242242

243243
// a regular expression can only be followed by a few operators or some
244244
// of the RegExp methods (a `\` followed by a variable or value is

0 commit comments

Comments
 (0)