-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-System.Text.RegularExpressionsbughelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
This issue has been moved from a ticket on Developer Community.
Create the following class:
public static class Foo
{
public static readonly Regex IllegalCharactersRegex = new("[" + @"\/:<>|" + "\"]", RegexOptions.Compiled);
}
The quick fix suggest to convert the regex to 'GeneratedRegexAttribute'.
If you do, it generates the following code :
public static partial class Foo
{
public static readonly Regex IllegalCharactersRegex = MyRegex();
[GeneratedRegex(@"[\/:<>|"]", RegexOptions.Compiled)]
private static partial Regex MyRegex();
}
But the string is badly formed. It should be @"[/:<>|""]" instead.
Original Comments
Feedback Bot on 6/16/2024, 11:03 PM:
(private comment, text removed)
Original Solutions
(no solutions)
julealgon
Metadata
Metadata
Assignees
Labels
area-System.Text.RegularExpressionsbughelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors