Skip to content

Conversation

stephentoub
Copy link
Member

Fixes #117637.

@Copilot Copilot AI review requested due to automatic review settings July 22, 2025 02:01
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the RegexCharClass.DescribeSet method where dashes (-) were not being properly escaped in the output, which could result in invalid or ambiguous character class descriptions. The fix ensures that dashes are properly escaped as \- to avoid confusion with range operators in regex character classes.

Key Changes:

  • Added escaping for dash characters in DescribeChar method
  • Added test case to verify correct escaping behavior

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
RegexCharClass.cs Added dash character escaping in the DescribeChar method
RegexCharClassTests.cs Added test case to verify dash escaping functionality

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.

@stephentoub
Copy link
Member Author

/ba-g timeouts

@stephentoub stephentoub enabled auto-merge (squash) July 22, 2025 12:10
@stephentoub stephentoub merged commit 4668546 into dotnet:main Jul 22, 2025
83 of 88 checks passed
@stephentoub stephentoub deleted the escapedashes branch July 22, 2025 12:10
@github-actions github-actions bot locked and limited conversation to collaborators Aug 22, 2025
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.

GeneratedRegex comments rearrange characters in character classes
3 participants