Skip to content

emit nullopt for unmatched groups in std_regex_provider::regex_search#1148

Merged
anonrig merged 1 commit into
ada-url:mainfrom
metsw24-max:regex-search-unmatched-group-alignment
May 25, 2026
Merged

emit nullopt for unmatched groups in std_regex_provider::regex_search#1148
anonrig merged 1 commit into
ada-url:mainfrom
metsw24-max:regex-search-unmatched-group-alignment

Conversation

@metsw24-max
Copy link
Copy Markdown
Contributor

Noticed regex_search only pushes capture groups whose submatch participated, while create_component_match_result maps the returned vector onto the group name list by position. An optional group that does not match (e.g. pathname (a)?(b) against b) drops a slot, so b is reported under name "0" instead of "1" and group "1" disappears. Push nullopt for non-participating groups so undefined groups stay aligned with their names. The harness already skips WPT cases with null group values, which is why this was not caught.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 59.87%. Comparing base (d421a79) to head (3205011).

Files with missing lines Patch % Lines
src/url_pattern_regex.cpp 0.00% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1148      +/-   ##
==========================================
- Coverage   59.88%   59.87%   -0.01%     
==========================================
  Files          37       37              
  Lines        6132     6133       +1     
  Branches     2977     2978       +1     
==========================================
  Hits         3672     3672              
  Misses        617      617              
- Partials     1843     1844       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anonrig anonrig merged commit 9463d20 into ada-url:main May 25, 2026
52 of 54 checks passed
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