Skip to content

Commit 5ce03b7

Browse files
committed
fix: matchers using global regexes
1 parent 564b973 commit 5ce03b7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/matches.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export function matches(
1818
? normalizedText === normalizedMatcher
1919
: normalizedText.toLowerCase().includes(normalizedMatcher.toLowerCase());
2020
} else {
21+
// Reset state for global regexes: https://stackoverflow.com/a/1520839/484499
22+
matcher.lastIndex = 0;
2123
return matcher.test(normalizedText);
2224
}
2325
}

0 commit comments

Comments
 (0)