Skip to content

Regex parser regression #102643

@jacobzed

Description

@jacobzed

Description

The following regex doesn't match in .net 8. The same regex matches in framework 4.72.

Reproduction Steps

var re = new Regex(@"^(.+?) (says?),\s'(.+)'$", RegexOptions.RightToLeft);
var sample = "User says, 'adventure'";
var match = re.Match(sample);
Console.WriteLine(match.Success); // should return true like in 4.72

Expected behavior

Regex match success

Actual behavior

Regex match fails

Regression?

Yes, this works in Framework 4.72

Known Workarounds

Removing RegexOptions.RightToLeft, or putting "s?" outside capturing group:
var re = new Regex(@"^(.+?) (say)s?,\s'(.+)'$", RegexOptions.RightToLeft);

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions