Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<regex>: Make negated character classes not match characters not included in the negated character class #5214

Conversation

muellerj2
Copy link
Contributor

@muellerj2 muellerj2 commented Dec 30, 2024

Partially addresses #992 again. While there is no easy way to make negated character class escapes (in square-bracket character classes) match members of the class, we can at least make sure that such escapes don't match non-members.

Drive-by changes:

  • Correct the limit check (although I think the correction has no practical consequences).
  • Change _Builder::_Add_named_class and _Builder::_Add_elts to use the char_class_type of the traits class instead of _Regex_traits_base::char_class_type when adding a character class.
  • Remove the default argument from _Builder::_Add_named_class.

@muellerj2 muellerj2 requested a review from a team as a code owner December 30, 2024 14:36
@muellerj2 muellerj2 force-pushed the regex-make-negated-character-class-escapes-not-match-non-members branch from fcd90ca to 45e47b4 Compare January 1, 2025 12:51
@StephanTLavavej StephanTLavavej added the bug Something isn't working label Jan 4, 2025
@StephanTLavavej StephanTLavavej self-assigned this Jan 4, 2025
@StephanTLavavej StephanTLavavej added the regex Everyone's favorite header label Jan 8, 2025
stl/inc/regex Show resolved Hide resolved
@StephanTLavavej StephanTLavavej removed their assignment Jan 12, 2025
@StephanTLavavej StephanTLavavej self-assigned this Jan 13, 2025
@StephanTLavavej
Copy link
Member

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

@StephanTLavavej StephanTLavavej merged commit 63fe8a2 into microsoft:main Jan 14, 2025
39 checks passed
@StephanTLavavej
Copy link
Member

Thanks for asymptotically fixing this bug! 😹 🐞 📈

@muellerj2 muellerj2 deleted the regex-make-negated-character-class-escapes-not-match-non-members branch January 14, 2025 20:26
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 Everyone's favorite header
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants