Skip to content

Regex: different result for Regex.Match in .NET 5.0 and .NET Framework 4.7.2 #56721

Closed

Description

@anreton

Product and Version Used:
.NET 5.0
.NET Framework 4.7.2

Steps to Reproduce:

var regex = @"^(?<region>\d{2,3}){2}$";    
var match = Regex.Match("3636", regex);
Console.Write(match.Success);

Actual Behavior:
In .NET 5.0 - get false (https://dotnetfiddle.net/O4g19l).
In .NET Framework 4.7.2 - get true (https://dotnetfiddle.net/fskkZu).

Expected Behavior:
Same result for Regex.Match in .NET 5.0 and .NET Framework 4.7.2.

Activity

  1. ghost added
    untriaged
    on Aug 2, 2021
  2. changed the title [-]Regex: different result for Regex.Match in .NET 5.0 and .NET Framework 4.7.2[/-] [+]Regex: different result for `Regex.Match` in .NET 5.0 and .NET Framework 4.7.2[/+] on Aug 2, 2021
  3. changed the title [-]Regex: different result for `Regex.Match` in .NET 5.0 and .NET Framework 4.7.2[/-] [+]Regex: different result for Regex.Match in .NET 5.0 and .NET Framework 4.7.2[/+] on Aug 2, 2021
  4. added this to the 6.0.0 milestone on Aug 2, 2021
  5. self-assigned this
    on Aug 2, 2021
  6. removed
    untriaged
    on Aug 2, 2021
  7. ghost added
    in-pr
    on Aug 2, 2021
  8. ghost removed
    in-pr
    on Aug 9, 2021
  9. ghost locked as resolved and limited conversation to collaborators on Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions