Skip to content

Conversation

muellerj2
Copy link
Contributor

Fixes #5243 by repurposing another unused flag bit when the combined character class of "w" and another named class has to be represented.

After this PR, a different value is assigned to the _Classes field in the NFA node when we run into the buggy scenario, but the code takes care that the same value is assigned in all other cases. This means that the old matcher may only match different characters in the buggy scenario for code points >= 0x100: It will now match the members of the other named character classes rather than the members of the character class "w".

@muellerj2 muellerj2 requested a review from a team as a code owner April 25, 2025 19:30
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews Apr 25, 2025
@muellerj2 muellerj2 changed the title <regex>: Make wregex properly match the combination of \w and another named character class <regex>: Make wregex properly match the combination of \w and another named character class Apr 25, 2025
@StephanTLavavej StephanTLavavej added bug Something isn't working regex meow is a substring of homeowner labels Apr 25, 2025
@StephanTLavavej StephanTLavavej self-assigned this Apr 25, 2025
@StephanTLavavej StephanTLavavej removed their assignment May 3, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Ready To Merge in STL Code Reviews May 3, 2025
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews May 9, 2025
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

StephanTLavavej added a commit to StephanTLavavej/STL that referenced this pull request May 9, 2025
@StephanTLavavej StephanTLavavej merged commit 1e03174 into microsoft:main May 10, 2025
39 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews May 10, 2025
@StephanTLavavej
Copy link
Member

Thanks for figuring out how to fix this bug while preserving ABI! 😻 💚 🐈

@muellerj2 muellerj2 deleted the regex-combining-w-and-another-class branch May 31, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regex meow is a substring of homeowner
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

<regex>: wregex with regular expression [\w\s] fails to match some spaces
2 participants