@@ -26,6 +26,7 @@ This package currently supports:
2626- ** SignalR Extensions** for adding simple SignalR or distributed SignalR backed with Redis.
2727- ** OpenTelemetry** : Metrics, traces, and logs with Prometheus support.
2828- ** Health Checks** : Startup validation and endpoints for monitoring.
29+ - ** ValidationHelper** : A collection of regex-based validators for common data formats.
2930- Various ** Extensions and Utilities** , including enumerable, string, dictionary and queryable extensions.
3031
3132## Prerequisites
@@ -315,11 +316,12 @@ builder.AddSerilog(
315316);
316317```
317318
318- > - ** Asynchronous Sinks (asyncSinks: true):** Recommended for very high-traffic environments (e.g., 1000+ requests per
319- second per pod) where performance is critical and the possibility of losing a small amount of log data (e.g., on
320- sudden process termination) is acceptable. <br ><br >
321- > - ** Synchronous Sinks (asyncSinks: false):** Recommended if you can handle up to ~ 1000 requests per second per pod and must
322- retain every log entry without fail. This might incur slightly more overhead but ensures maximum reliability.
319+ > - ** Asynchronous Sinks (asyncSinks: true):** Recommended for very high-traffic environments (e.g., 1000+ requests per
320+ second per pod) where performance is critical and the possibility of losing a small amount of log data (e.g., on
321+ sudden process termination) is acceptable. <br><br>
322+ > - ** Synchronous Sinks (asyncSinks: false):** Recommended if you can handle up to ~ 1000 requests per second per pod and
323+ must
324+ retain every log entry without fail. This might incur slightly more overhead but ensures maximum reliability.
323325
324326Configure minimal Serilog settings in your environment JSON files as needed, for example in
325327` appsettings.{Environment}.json ` :
@@ -651,6 +653,68 @@ app.MapHealthCheckEndpoints(); // Map health check routes
651653app .Run ();
652654```
653655
656+ ## ValidationHelper
657+
658+ The ` ValidationHelper ` class is a highly performant and robust C# class designed to simplify complex regex validations
659+ for
660+ various data formats. With 100% test coverage and a focus on security through a 50ms regex execution timeout, it's an
661+ ideal solution for applications requiring reliable and efficient data validation.
662+
663+ ``` csharp
664+ using Pandatech .RegexBox ;
665+
666+ // URI validation
667+ bool isValidUri = ValidationHelper .IsUri (" http://example.com" , allowNonSecure : false );
668+
669+ // US Social Security Number validation
670+ bool isValidSsnUs = ValidationHelper .IsUsSocialSecurityNumber (" 123-45-6789" );
671+
672+ // Email validation
673+ bool isValidEmail = ValidationHelper .
IsEmail (
" [email protected] " );
674+
675+ // Username validation
676+ bool isValidUsername = ValidationHelper .IsUsername (" user123" );
677+
678+ // Armenian Social Security Number validation
679+ bool isValidSsnAm = ValidationHelper .IsArmeniaSocialSecurityNumber (" 12345678912" );
680+
681+ // ArmenianIDCard validation
682+ bool isValidArmenianIdCard = ValidationHelper .IsArmeniaIdCard (" AN1234567" );
683+
684+ // Armenian Passport validation
685+ bool isValidArmenianPassport = ValidationHelper .IsArmeniaPassport (" AN1234567" );
686+
687+ // Armenian Tax code validation
688+ bool isValidArmenianTaxCode = ValidationHelper .IsArmeniaTaxCode (" 12345678" );
689+
690+ // Panda Formatted Phone Number validation
691+ bool isValidPhoneNumber = ValidationHelper .IsPandaFormattedPhoneNumber (" (374)94810553" );
692+
693+ // Armenian State Registration Number validation
694+ bool isValidArmenianStateRegistrationNumber = ValidationHelper .IsArmeniaStateRegistryNumber (" 123.456.78" );
695+
696+ // Panda formatted phone number validation
697+
698+ bool isValidPandaFormattedPhoneNumber = ValidationHelper .IsPandaFormattedPhoneNumber (" (374)94810553" );
699+
700+ // Guid validation
701+ bool isValidGuid = ValidationHelper .IsGuid (" 12345678-1234-1234-1234-123456789012" );
702+
703+ // IPv4 validation
704+ bool isValidIpv4 = ValidationHelper .IsIPv4 (" 192.168.1.1" );
705+
706+ // IPv6 validation
707+ bool isValidIpv6 = ValidationHelper .IsIPv6 (" 2001:0db8:85a3:0000:0000:8a2e:0370:7334" );
708+
709+ // Any IP validation
710+ bool isValidIp = ValidationHelper .IsIpAddress (" 192.168.1.1" );
711+
712+ // Json validation
713+ bool isValidJson = ValidationHelper .IsJson (" {\" name\" :\" John\" , \" age\" :30}" );
714+
715+ // and many more...
716+ ```
717+
654718## Additional Extensions and NuGet Packages
655719
656720This package includes various extensions and utilities to aid development:
@@ -671,7 +735,6 @@ This package includes various extensions and utilities to aid development:
671735
672736- ** Pandatech.Crypto:** Provides cryptographic utilities.
673737- ** Pandatech.FluentMinimalApiMapper:** Simplifies mapping in minimal APIs.
674- - ** Pandatech.RegexBox:** A collection of useful regular expressions.
675738- ** Pandatech.ResponseCrafter:** A utility for crafting consistent API responses.
676739- ** Pandatech.DistributedCache:** A distributed cache provider for Redis.
677740- ** Pandatech.FileExporter:** A utility for exporting files.
0 commit comments