budul.RegexExtensions
2.0.0
dotnet add package budul.RegexExtensions --version 2.0.0
NuGet\Install-Package budul.RegexExtensions -Version 2.0.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="budul.RegexExtensions" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="budul.RegexExtensions" Version="2.0.0" />
<PackageReference Include="budul.RegexExtensions" />
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 budul.RegexExtensions --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: budul.RegexExtensions, 2.0.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 budul.RegexExtensions@2.0.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=budul.RegexExtensions&version=2.0.0
#tool nuget:?package=budul.RegexExtensions&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RegexExtensions
Multiple extension methods to ease the determination of regex matches.
Installation
dotnet add package budul.RegexExtensions
Target framework: net10.0.
Usage
All matches are full matches: the pattern has to match the whole input. Line breaks in a pattern separate alternatives.
using RegexExtensions;
// Full match, case-insensitive by default
var isMatch = "abc".IsMatch(".{3}"); // true
var isPartial = "abc".IsMatch(".{2}"); // false
// Each line is an alternative
var isAlternative = "Bus B".IsMatch("Bus A\nBus B"); // true
// Build the full match pattern yourself
var pattern = new[] { "Bus A", "Bus B" }.GetFullmatchPattern(); // \A(?:Bus A|Bus B)\z
// An empty pattern means no filter
var passes = "abc".IsMatchOrEmptyPattern(null); // true
// An empty value or an empty pattern means no filter
var passesEmpty = ((string?)null).IsMatchOrEmptyPatternOrEmptyValue(".{2}"); // true
// Limit the duration of a match, e.g. for patterns from untrusted sources
var limited = "abc".IsMatch(".{3}", matchTimeout: TimeSpan.FromSeconds(1)); // true
Notes:
IsMatchreturnsfalsefor an empty or whitespace-only input or pattern.- The default options are
IgnoreCase | Multiline | CultureInvariant. - Lines of a pattern are not trimmed. Multi-line patterns cannot be combined with
RegexOptions.IgnorePatternWhitespace. - An invalid pattern throws a
RegexParseException, an exceeded match timeout aRegexMatchTimeoutException. - The regexes are cached internally per pattern, options and timeout (up to 256 entries).
Migration
1.x to 2.0
- The package targets
net10.0only. Version 1.x stays available fornetstandard2.0,netstandard2.1and .NET Framework. - Nullable reference types are annotated.
- Case-insensitive matching is culture-invariant by default.
- The match methods accept an optional
matchTimeout.
Build and test
Requires Visual Studio 2026 and the .NET 10 SDK (see global.json).
dotnet test
License
MIT, see LICENSE.
| Product | Versions 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on budul.RegexExtensions:
| Package | Downloads |
|---|---|
|
budul.CSVReader
Deserializer for values from CSV files |
GitHub repositories
This package is not used by any popular GitHub repositories.