Masterly.FluentRegex.AI 3.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Masterly.FluentRegex.AI --version 3.1.1
                    
NuGet\Install-Package Masterly.FluentRegex.AI -Version 3.1.1
                    
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="Masterly.FluentRegex.AI" Version="3.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Masterly.FluentRegex.AI" Version="3.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Masterly.FluentRegex.AI" />
                    
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 Masterly.FluentRegex.AI --version 3.1.1
                    
#r "nuget: Masterly.FluentRegex.AI, 3.1.1"
                    
#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 Masterly.FluentRegex.AI@3.1.1
                    
#: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=Masterly.FluentRegex.AI&version=3.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Masterly.FluentRegex.AI&version=3.1.1
                    
Install as a Cake Tool

Masterly.FluentRegex.AI

Draft Masterly.FluentRegex patterns from plain language with Claude, and verify every draft locally before you see it.

using Masterly.FluentRegex;
using Masterly.FluentRegex.AI;

PatternAssistant assistant = new PatternAssistant(
    httpClient,                                           // from IHttpClientFactory; not disposed by the assistant
    new PatternAssistantOptions { ApiKey = Environment.GetEnvironmentVariable("ANTHROPIC_API_KEY")! });

PatternDraft draft = await assistant.DraftAsync(
    "a five digit US ZIP code, optionally followed by a dash and four digits",
    shouldMatch: new[] { "12345", "12345-6789" },
    shouldNotMatch: new[] { "1234", "123456", "12345-678" });

if (draft.Passed)
{
    Pattern zip = draft.Pattern!;
}
else
{
    Console.WriteLine(draft);   // the best attempt and exactly which checks failed
}

Each draft must pass, on your machine: valid .NET syntax, no findings from Pattern.AnalyzeSafety() (ReDoS), every shouldMatch string matched in full, and no shouldNotMatch string matched. Failures are sent back to the model as precise feedback and retried up to MaxAttempts (default 3). If no draft passes you get the best attempt with Passed == false; a draft is never reported as passing unless it did.

  • Calls the Claude Messages API directly with HttpClient and source-generated System.Text.Json; no SDK dependency, AOT and trim safe.
  • Defaults: model claude-opus-5-5, effort medium, structured JSON output, server-side refusal fallback.
  • HTTP failures throw PatternAssistantException with StatusCode, ErrorType, RequestId, RetryAfter and IsTransient. The assistant does not retry HTTP errors itself; add a resilience handler to the HttpClient if you want that. The API key never appears in messages or ToString().
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
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
3.2.0 75 11/4/2026
3.1.1 74 11/3/2026
3.1.0 72 11/3/2026