-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Description
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