.NET 7 Preview 2
devblogs.microsoft.com
devblogs.microsoft.com
Regex myRegex = Regex.Generated(“…”)
or Regex myRegex = MyRegex()
[RegexGenerated(…)]
partial class MyRegex {}You can read the development discussion and syntax reasoning in the GitHub issue: https://github.com/dotnet/runtime/issues/44676