HumanRegexBuilder 1.0.3

dotnet add package HumanRegexBuilder --version 1.0.3
                    
NuGet\Install-Package HumanRegexBuilder -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="HumanRegexBuilder" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HumanRegexBuilder" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="HumanRegexBuilder" />
                    
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 HumanRegexBuilder --version 1.0.3
                    
#r "nuget: HumanRegexBuilder, 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.
#:package HumanRegexBuilder@1.0.3
                    
#: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=HumanRegexBuilder&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=HumanRegexBuilder&version=1.0.3
                    
Install as a Cake Tool

Human Regex Generator

Human-friendly regular expression builder with English-like syntax.

Features

  • Intuitive builder pattern with Fluent methods.
  • Exports a Regex instance or just the string to be used with other Regex libraries.

Usage

Basic example

 var builder = HumanRegex.Create()
            .StartAnchor()
            .Word()
            .OneOrMore()
            .Literal("@")
            .Word()
            .OneOrMore()
            .StartGroup()
            .Literal(".")
            .Word()
            .OneOrMore()
            .EndGroup()
            .ZeroOrMore()
            .Literal(".")
            .Letter()
            .AtLeast(2)
            .EndAnchor().ToRegExp();
 
 Console.WriteLine(builder.Match("test@example.com").Success) // true

API Reference

Initialize the chain with HumanRegex.Create() then start chaining the rest of the Regex methods.

Core Methods

Method Description Example Output
.Digit() Adds a digit pattern (\d). \d
.Word() Adds a word character pattern (\w). \w
.Whitespace() Adds a whitespace character pattern (\s). \s
.NonWhitespace() Adds a non-whitespace character pattern (\S). \S
.AnyCharacter() Adds a pattern for any character (.). .
.Literal("text") Adds a literal text pattern. ["text"]
.Or() Adds an OR pattern. \|
.Range("digit") Adds a range pattern for digits (0-9). [0-9]
.NotRange("aeiou") Excludes characters from the pattern. [^aeiou]

Quantifiers

Method Description Example Output
.Exactly(n) Adds an exact quantifier ({n}). {n}
.AtLeast(n) Adds a minimum quantifier ({n,}). {n,}
.AtMost(n) Adds a maximum quantifier ({0,n}). {0,n}
.Between(min, max) Adds a range quantifier ({min,max}). {min,max}
.OneOrMore() Adds a one-or-more quantifier (+). +
.Optional() Adds an optional quantifier (?). ?
.ZeroOrMore() Adds a zero-or-more quantifier (*). *
.Lazy() Makes the previous quantifier lazy. ?
.Repeat(count) Repeats the previous pattern exactly count times. {count}

Anchors & Groups

Method Description Example Output
.StartGroup() Starts a non-capturing group ((?:). (?:
.StartCaptureGroup() Starts a capturing group ((). (
.StartNamedGroup("name") Starts a named capturing group. (?<name>
.EndGroup() Ends a group ()). )
.StartAnchor() Adds a start anchor (^). ^
.EndAnchor() Adds an end anchor ($). $
.WordBoundary() Adds a word boundary assertion (\b). \b
.NonWordBoundary() Adds a non-word boundary assertion (\B). \B

Validation Helpers

Method Description Example Output
.HasSpecialCharacter() Adds a lookahead for special characters. (?=.*[!@#$%^&*])
.HasDigit() Adds a lookahead for digits. (?=.*\d)
.HasLetter() Adds a lookahead for letters. (?=.*[a-zA-Z])

URL Components

Method Description Example Output
.Protocol() Adds a protocol pattern (https?://). https?://
.Www() Adds a www pattern ((www\.)?). (www\.)?
.Path() Adds a path pattern ((/\w+)*). (/\w+)*
.Tld() Adds a top-level domain pattern. ["(com|org|net)"]

Flags

Method Description Example Output
.Global() Adds the global flag (g). g
.NonSensitive() Adds the case-insensitive flag (i). i
.Multiline() Adds the multiline flag (m). m
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 was computed.  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.  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 was computed.  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. 
.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 was computed. 
.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.
  • 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 226 3/6/2025
1.0.2 105 2/26/2025
1.0.1 95 2/26/2025
1.0.0 107 2/25/2025