Skip to content

v1.5.0

Latest

Choose a tag to compare

@ltrzesniewski ltrzesniewski released this 15 Jun 18:14
  • Adds a source generator which optimizes PcreRegex calls when constant values are used:
    • Static method calls in the PcreRegex class, such as PcreRegex.Match(string subject, string pattern, PcreOptions options), with constant patterns and options will be permanently cached in a dedicated static field on their first use.
      Therefore, usage of PcreOptions.Compiled is now encouraged in these situations, as the compilation will occur only once.
    • Constant replacement strings used in PcreRegex.Replace methods will be pre-compiled, for both static and instance methods. Note that PcreRegex.Substitute is not affected.

This feature requires Roslyn 5.0 (shipped in the .NET 10 SDK or with Visual Studio 2026 version 18.0) and usage of C# 11 or later. It is AOT-compatible and transitive across projects.

If needed, it can be disabled by setting the PcreNetInterceptors property to false in your project file.