SimpleValidationLibrary 6.0.0
See the version list below for details.
dotnet add package SimpleValidationLibrary --version 6.0.0
NuGet\Install-Package SimpleValidationLibrary -Version 6.0.0
<PackageReference Include="SimpleValidationLibrary" Version="6.0.0" />
<PackageVersion Include="SimpleValidationLibrary" Version="6.0.0" />
<PackageReference Include="SimpleValidationLibrary" />
paket add SimpleValidationLibrary --version 6.0.0
#r "nuget: SimpleValidationLibrary, 6.0.0"
#:package SimpleValidationLibrary@6.0.0
#addin nuget:?package=SimpleValidationLibrary&version=6.0.0
#tool nuget:?package=SimpleValidationLibrary&version=6.0.0
Simple Validation Library
A lightweight .NET library for validating emails, region-aware phone numbers, dates, and custom regex-based rules — with clear, typed exceptions instead of boolean guesswork.
Features
- Email validation —
IsValidEmail - Phone number validation with regional rules (USA, UK, Spain, Ireland) —
IsValidPhoneNumber - Postal code validation with regional rules (USA, UK, Spain, Ireland) —
IsValidPostalCode - Date validation —
IsValidDate - URL validation (http/https) —
IsValidUrl - Credit card number validation (Luhn checksum) —
IsValidCreditCardNumber - Password strength validation (configurable rules) —
IsValidPassword - IP address validation (IPv4 and IPv6) —
IsValidIPAddress - Numeric range validation —
IsInRange - String length validation —
IsValidLength - Custom validations — register your own named regex rules via
IsValidCustom - Typed exceptions (
ValidationException,UnsupportedRegionException) for precise error handling
Installation
dotnet add package SimpleValidationLibrary
Usage
using ValidationLibrary;
// Email
Validator.IsValidEmail("user@example.com"); // returns true, or throws Validator.ValidationException
// Phone number (region-aware)
Validator.IsValidPhoneNumber("612345678", RegionEnum.Region.Spain);
// Postal code (region-aware)
Validator.IsValidPostalCode("28001", RegionEnum.Region.Spain);
// Date
Validator.IsValidDate("2026-01-15");
// URL
Validator.IsValidUrl("https://example.com");
// Credit card number (Luhn checksum)
Validator.IsValidCreditCardNumber("4111 1111 1111 1111");
// Password strength (configurable)
Validator.IsValidPassword("Str0ng!Pass");
Validator.IsValidPassword("simplepass", minLength: 6, requireUppercase: false, requireDigit: false, requireSpecialChar: false);
// IP address (IPv4 or IPv6)
Validator.IsValidIPAddress("192.168.1.1");
// Numeric range
Validator.IsInRange(5, 1, 10);
// String length
Validator.IsValidLength("hello", 1, 10);
// Custom rule
Validator.CustomValidations["digits-only"] = @"^\d+$";
Validator.IsValidCustom("12345", "digits-only");
Handling validation errors
try
{
Validator.IsValidEmail("not-an-email");
}
catch (Validator.ValidationException ex)
{
Console.WriteLine(ex.Message); // "Invalid email."
}
Requirements
- .NET 10.0 or later
Source & issues
https://github.com/AdrianBailador/SimpleValidationLibrary
License
MIT
| 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. |
-
net10.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.
Complete rewrite of the legacy, deprecated 5.0.0 release: migrated to .NET 10, fixed PackageId resolving to an empty string, aligned namespaces, added full test coverage, and added IsValidPostalCode (region-aware), IsValidUrl, IsValidCreditCardNumber (Luhn check), IsValidPassword, IsValidIPAddress, IsInRange, and IsValidLength.