Bromix.Fluent.RegularExpression 1.0.3

Prefix Reserved
dotnet add package Bromix.Fluent.RegularExpression --version 1.0.3                
NuGet\Install-Package Bromix.Fluent.RegularExpression -Version 1.0.3                
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="Bromix.Fluent.RegularExpression" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Bromix.Fluent.RegularExpression --version 1.0.3                
#r "nuget: Bromix.Fluent.RegularExpression, 1.0.3"                
#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.
// Install Bromix.Fluent.RegularExpression as a Cake Addin
#addin nuget:?package=Bromix.Fluent.RegularExpression&version=1.0.3

// Install Bromix.Fluent.RegularExpression as a Cake Tool
#tool nuget:?package=Bromix.Fluent.RegularExpression&version=1.0.3                

Nuget Nuget GitHub

Fluent RegularExpression

The Bromix.Fluent.RegularExpression package provides a fluent API for building regular expression patterns in C#. This can be useful in situations where regular expressions are complex or difficult to maintain, or when they need to be generated dynamically based on external data inputs.

Installation via dotnet CLI

  1. Open a command prompt or terminal
  2. Navigate to your project directory
  3. Run the following command:
dotnet add package Bromix.Fluent.RegularExpression

Usage

Here are some simple examples to get a sense of how it works. For more detailed information, you can use the wiki.

Match Year

The pattern could be \d{4} and can be written with Fluent Regular Expression like this.

using Bromix.Fluent.RegularExpression;

var pattern = Pattern
    .With()
    .Digit(Quantifier.Exactly(4))
    .ToString();

var regex = new Regex(pattern);
var match = regex.Match("2023");
Console.WriteLine(match);

Match Mail

The pattern could be ^[a-zA-Z0-9._%\-+]+@[a-zA-Z0-9._]+.[a-zA-Z]{2,}$ and can be written with Fluent Regular Expression like this.

using Bromix.Fluent.RegularExpression;

var pattern = Pattern
    .With()
    .StartOfLine()
    .CharacterClass(Quantifier.OneOrMore, cc => cc
        .Range('a', 'z')
        .Range('A', 'Z')
        .Range('0', '9')
        .OneOf('.', '_', '%', '-', '+'))
    .Literal("@")
    .CharacterClass(Quantifier.OneOrMore, cc => cc
        .Range('a', 'z')
        .Range('A', 'Z')
        .Range('0', '9')
        .OneOf('.', '_'))
    .Literal(".")
    .CharacterClass(Quantifier.AtLeast(2), cc => cc
        .Range('a', 'z')
        .Range('A', 'Z'))
    .EndOfLine()
    .ToString();

    var regex = new Regex(pattern);
    var match = regex.Match(input);
    Console.WriteLine(match.Success);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

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
1.0.3 200 1/1/2024
1.0.2 183 7/12/2023
1.0.1 163 7/8/2023
1.0.0 168 7/8/2023
0.0.5 174 4/26/2023
0.0.4 171 4/26/2023
0.0.3 187 4/23/2023
0.0.2 184 4/23/2023
0.0.2-preview-1 142 4/23/2023
0.0.1 177 4/23/2023
0.0.1-preview-7 144 4/23/2023
0.0.1-preview-3 145 4/23/2023
0.0.1-preview-2 141 4/22/2023