Skip to content

<regex>: Allow initial ] to start character ranges in POSIX regular expressions #5364

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

Conversation

muellerj2
Copy link
Contributor

Fixes a regex miscompilation noticed in #5165.

The POSIX standard says that the right bracket ] is not special at the beginning of a bracketed character class (https://pubs.opengroup.org/onlinepubs/009696699/basedefs/xbd_chap09.html#tag_09_03_05). This means that an initial ] behaves like any other character, so it may also be the start of a character range.

@muellerj2 muellerj2 requested a review from a team as a code owner March 25, 2025 22:13
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews Mar 25, 2025
@StephanTLavavej StephanTLavavej added bug Something isn't working regex meow is a substring of homeowner labels Mar 25, 2025
@StephanTLavavej StephanTLavavej self-assigned this Mar 25, 2025
@StephanTLavavej StephanTLavavej changed the title <regex>: Allow initial ] to start character ranges in POSIX regular expressions <regex>: Allow initial ] to start character ranges in POSIX regular expressions Mar 25, 2025
@StephanTLavavej
Copy link
Member

Thanks! 😻 I pushed changes to significantly expand the test coverage.

@StephanTLavavej StephanTLavavej removed their assignment Apr 2, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Ready To Merge in STL Code Reviews Apr 2, 2025
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Apr 9, 2025
@StephanTLavavej StephanTLavavej self-assigned this Apr 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
Copy link
Member

Resolved adjacent-add conflict in VSO_0000000_regex_use.

@StephanTLavavej StephanTLavavej merged commit 5a1cbde into microsoft:main Apr 10, 2025
39 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews Apr 10, 2025
@StephanTLavavej
Copy link
Member

🥕 💵 ⭐

@muellerj2 muellerj2 deleted the regex-fix-initial-right-bracket-in-posix-regexes branch April 13, 2025 13:44
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.

2 participants