You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Looks like this was introduced as part of an optimization that shouldn't be applying to RTL. We're looking to see whether we can combine loops with a multi that comes after it (a multi follows a loop in the example pattern because RTL ends up reversing concatenations), but because of the RTL we're looking at the wrong end of the multi, so it ends up erroneously combining the s? with the s that begins "say".
Description
The following regex doesn't match in .net 8. The same regex matches in framework 4.72.
Reproduction Steps
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
The text was updated successfully, but these errors were encountered: