Skip to content

Commit df69c33

Browse files
committed
fix: recreate regex to prevent regex with global flags
1 parent ca084c0 commit df69c33

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/matches.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function matches(
5656
if (matcher instanceof Function) {
5757
return matcher(normalizedText, node)
5858
} else if (matcher instanceof RegExp) {
59-
return matcher.test(normalizedText)
59+
return new RegExp(matcher).test(normalizedText)
6060
} else {
6161
return normalizedText === String(matcher)
6262
}

0 commit comments

Comments
 (0)