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

Fix incorrect suffix search for alternation with RegexOptions.RightToLeft #101408

Merged
merged 4 commits into from
Apr 23, 2024

Conversation

stephentoub
Copy link
Member

Our limited RegexOptions.RightToLeft support for prefix optimizations is mishandling alternations. For RTL, this actually needs to create a suffix, but for alternations, we were actually creating a prefix. As this option is rarely used and it's not worth significant investment in optimizing, the fix is just to disable the handling of alternations for RTL, as the support has been broken since it was introduced in .NET 7.

Fixes #101223

…Left

Our limited RegexOptions.RightToLeft support for prefix optimizations is mishandling alternations. For RTL, this actually needs to create a suffix, but for alternations, we were actually creating a prefix. As this option is rarely used and it's not worth significant investment in optimizing, the fix is just to disable the handling of alternations for RTL, as the support has been broken since it was introduced in .NET 7.
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

@danmoseley
Copy link
Member

Nit, isDebug could use PlatformDetection.IsDebugLibrary. I could tweak that next time I have some PR.

matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
…Left (dotnet#101408)

* Fix incorrect suffix search for alternation with RegexOptions.RightToLeft

Our limited RegexOptions.RightToLeft support for prefix optimizations is mishandling alternations. For RTL, this actually needs to create a suffix, but for alternations, we were actually creating a prefix. As this option is rarely used and it's not worth significant investment in optimizing, the fix is just to disable the handling of alternations for RTL, as the support has been broken since it was introduced in .NET 7.

* Fix new tests

* Avoid annoying skip message
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
…Left (dotnet#101408)

* Fix incorrect suffix search for alternation with RegexOptions.RightToLeft

Our limited RegexOptions.RightToLeft support for prefix optimizations is mishandling alternations. For RTL, this actually needs to create a suffix, but for alternations, we were actually creating a prefix. As this option is rarely used and it's not worth significant investment in optimizing, the fix is just to disable the handling of alternations for RTL, as the support has been broken since it was introduced in .NET 7.

* Fix new tests

* Avoid annoying skip message
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regex.Match is different between .NET 8.0.4 and .NET Framework 4.8
2 participants