Skip to content

fix: reset stateful matcher regexes - #233

Open
somebeing2 wants to merge 1 commit into
micromatch:masterfrom
somebeing2:fix/reset-regex-last-index
Open

somebeing2 wants to merge 1 commit into
micromatch:masterfrom
somebeing2:fix/reset-regex-last-index

Conversation

@somebeing2

Copy link
Copy Markdown

Summary

  • reset compiled regular expression lastIndex before standard and basename matching
  • keep reusable matchers deterministic with g, y, and gy flags
  • add regressions for repeated matching, ignore patterns, matchBase, and captures

Validation

  • npm test — passed
  • ESLint — passed
  • Mocha — 2,002 tests passed

Fixes #217.

Reset lastIndex before executing compiled expressions so reusable matchers remain deterministic with global and sticky flags.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reusable matchers with global or sticky flags retain lastIndex

1 participant