Skip to content

✨ feat(mq-lang): add capture builtin function for regex named group extraction#1272

Merged
harehare merged 3 commits intomainfrom
feat/add-capture-builtin-with-tests
Feb 13, 2026
Merged

✨ feat(mq-lang): add capture builtin function for regex named group extraction#1272
harehare merged 3 commits intomainfrom
feat/add-capture-builtin-with-tests

Conversation

@harehare
Copy link
Copy Markdown
Owner

Add capture builtin that extracts named regex groups into a dict. Fix dict key to use group name instead of matched text, and add integration tests covering named groups, no-match, single group, and markdown node inputs.

…xtraction

Add capture builtin that extracts named regex groups into a dict.
Fix dict key to use group name instead of matched text, and add
integration tests covering named groups, no-match, single group,
and markdown node inputs.
Copilot AI review requested due to automatic review settings February 13, 2026 13:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new capture builtin function to the mq-lang crate for extracting named regex groups into a dictionary. The implementation follows the existing patterns for regex-based builtin functions in the codebase, including proper regex caching and error handling.

Changes:

  • Added capture builtin function that extracts named capture groups from regex patterns into a dictionary
  • Implemented proper handling for strings, markdown nodes, and None values
  • Added comprehensive integration tests covering named groups, no-match scenarios, single groups, and markdown node inputs

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/mq-lang/src/eval/builtin.rs Implemented the CAPTURE builtin, capture_re and _capture_re helper functions, added function registration and documentation
crates/mq-run/tests/integration_tests.rs Added 4 integration test cases covering various capture scenarios including named groups, no matches, single groups, and markdown nodes

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 13, 2026

Merging this PR will not alter performance

✅ 29 untouched benchmarks


Comparing feat/add-capture-builtin-with-tests (3f5085b) with main (50eee78)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (2f5d0be) during the generation of this report, so 50eee78 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copilot AI review requested due to automatic review settings February 13, 2026 13:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@harehare harehare merged commit 02b18c1 into main Feb 13, 2026
7 checks passed
@harehare harehare deleted the feat/add-capture-builtin-with-tests branch February 13, 2026 14:04
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.

2 participants