Lokad.Utf8Regex.PythonRe 0.5.0

Prefix Reserved
dotnet add package Lokad.Utf8Regex.PythonRe --version 0.5.0
                    
NuGet\Install-Package Lokad.Utf8Regex.PythonRe -Version 0.5.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Lokad.Utf8Regex.PythonRe" Version="0.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lokad.Utf8Regex.PythonRe" Version="0.5.0" />
                    
Directory.Packages.props
<PackageReference Include="Lokad.Utf8Regex.PythonRe" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Lokad.Utf8Regex.PythonRe --version 0.5.0
                    
#r "nuget: Lokad.Utf8Regex.PythonRe, 0.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Lokad.Utf8Regex.PythonRe@0.5.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Lokad.Utf8Regex.PythonRe&version=0.5.0
                    
Install as a Cake Addin
#tool nuget:?package=Lokad.Utf8Regex.PythonRe&version=0.5.0
                    
Install as a Cake Tool

Lokad.Utf8Regex packages

Managed, bounds-checked regex libraries for .NET 10 and .NET 11. Match UTF-8 directly, using Unicode scalars and primary byte coordinates. No native regex binary or BCL matcher is used by the libraries.

Package Supported profile
Lokad.Utf8Regex .NET-style grammar, captures/history, backreferences, assertions, RTL and a NonBacktracking subset
Lokad.Utf8Regex.PythonRe Python re-style grammar, flags, capture numbering and result shaping
Lokad.Utf8Regex.Pcre2 Selected PCRE2 standard-matcher grammar, substitution, capture slots and partial probes
Lokad.Utf8Regex.Posix Invariant scalar POSIX ERE subset, leftmost-longest selection and hierarchical capture priority

Adapters require the exact matching Core version. These profiles have documented boundaries; they do not promise full .NET, Python, PCRE2 or locale-aware POSIX equivalence. POSIX excludes lookarounds, backreferences and locale collation. PCRE2 excludes DFA matching, invalid-UTF subject mode, callouts, split and full capture history; partial probing has a limited supported scope.

POSIX is case-sensitive by default. PosixCompileOptions.IgnoreCase uses invariant Unicode 16.0 simple-lowercase equivalence, retaining longest-match selection and original byte offsets. This single-scalar relation has no normalization or multi-scalar expansion: I/i pair, dotted/dotless I remain separate, and final sigma/long s are not merged with ordinary sigma/s. Brackets accept the case closure of their members, including fixed ASCII named classes; Newline composes with the option. It does not provide locale-aware POSIX classification.

Scalar matching and validation

using Lokad.Utf8Regex;

var regex = new Utf8Regex(".");
int count = regex.Count("A😀"u8); // 2 scalars
var match = regex.Match("😀"u8); // Utf8CaptureRange: byte endpoints [0, 4)

All profiles require already-valid UTF-8 subjects and unchanged borrowed bytes. Regex operations do not validate subjects or expose a validation policy. Check external bytes where they become text, using System.Text.Unicode.Utf8.IsValid when the host representation does not already guarantee validity. Malformed subjects have unspecified matching results; managed bounds checking, cancellation and enforceable resource limits remain. Pattern, template and assembled-output checks stay independent. Live route eligibility, scalar matching and output sizing may still inspect text. Match results expose byte endpoints only.

PCRE2's explicitly enabled \C byte atom and special \K ranges have separate slice-validity rules; check result slice properties before decoding those results.

Cancellation, limits and ownership

Synchronous cancellation observes the original token. One absolute deadline and finite work/depth/working/result policies cover the documented operation stages. Explicit compilation factories offer separate construction controls. Defaults are unlimited.

Memory limits admit modeled major buffers, retained payloads and growth overlap, not total heap/RSS, arbitrary callbacks/getters or host retention. Caller-owned output destinations are not producer-owned result allocations. Work units and capacity charges depend on the engine/version/route: recheck finite policies when upgrading. A refusal is distinct from no match; it does not publish truncated successful output or retry under a different allowance.

Keep borrowed input alive and unchanged. Follow each cursor's copy/alias contract and dispose program/result/cursor owners on early termination. Temporary loans refund synchronously. Owned snapshots keep their documented lifetime; continued host retention after releasing a receipt is the host's responsibility.

Upgrading and further documentation

Version 0.4 introduced scalar matching over strict UTF-8 in place of the older UTF-16 matching behavior. Version 0.5 adds .NET 11 assets and POSIX, consolidates byte-only results and requires caller-valid subjects across all profiles. When upgrading from 0.4, move whole-subject validation to the text boundary. If you used a 0.5 development build with a validation option, remove inputValidation arguments and InputValidation property reads.

NuGet's project-website link leads to the repository specifications, release notes, profile examples and benchmark tables. Those tables identify the measured sources and runtimes. NativeAOT publishing and trimming remain unqualified.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.0 0 11/27/2026
0.4.0 1,699 10/27/2026
0.3.0 166 8/28/2026
0.2.0 1,865 4/29/2026
0.1.0 144 4/29/2026