From 7469a4d014c03719427b666fe5fef8361be7bd57 Mon Sep 17 00:00:00 2001 From: honzapatCZ Date: Tue, 3 Nov 2026 16:35:09 +0100 Subject: [PATCH] Better reghex --- Validation/IdentifierTextAttribute.cs | 2 +- Validation/StandardDescriptionAttribute.cs | 2 +- Validation/StandardTextAttribute.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Validation/IdentifierTextAttribute.cs b/Validation/IdentifierTextAttribute.cs index 5f0cb6c..f6895a5 100644 --- a/Validation/IdentifierTextAttribute.cs +++ b/Validation/IdentifierTextAttribute.cs @@ -7,7 +7,7 @@ using System.Text.RegularExpressions; namespace NejCommon.Validation; public class IdentifierTextAttribute : RegexAttribute{ - public IdentifierTextAttribute() : base("^[a-zA-Z0-9._-]+$","Aa_bb-12.3"){ + public IdentifierTextAttribute() : base(@"\A[A-Za-z0-9][A-Za-z0-9._/-]*\z","Aa_bb-12.3"){ } } \ No newline at end of file diff --git a/Validation/StandardDescriptionAttribute.cs b/Validation/StandardDescriptionAttribute.cs index 7591604..23b932c 100644 --- a/Validation/StandardDescriptionAttribute.cs +++ b/Validation/StandardDescriptionAttribute.cs @@ -7,7 +7,7 @@ using System.Text.RegularExpressions; namespace NejCommon.Validation; public class StandardDescriptionAttribute : RegexAttribute{ - public StandardDescriptionAttribute() : base(@"^[\p{L}\p{N}\p{P}\s]*$","Brown fox's - jumping over lazy dogs.", "Only normal characters are allowed, no emjos, etc."){ + public StandardDescriptionAttribute() : base(@"\A[\p{L}\p{M}\p{N}\p{P}\p{Zs}&+@€$%]+\z","Brown fox's - jumping over \"lazy\"(dogs).", "Only normal characters are allowed, no emjos, etc."){ } } \ No newline at end of file diff --git a/Validation/StandardTextAttribute.cs b/Validation/StandardTextAttribute.cs index f21daf3..0dbcd1e 100644 --- a/Validation/StandardTextAttribute.cs +++ b/Validation/StandardTextAttribute.cs @@ -7,7 +7,7 @@ using System.Text.RegularExpressions; namespace NejCommon.Validation; public class StandardTextAttribute : RegexAttribute{ - public StandardTextAttribute() : base(@"^[\p{L}\p{N}\-_,. ]*$","Příliš žlouťoučký kůň úpěl 2 ďábelské ódy"){ + public StandardTextAttribute() : base(@"\A(?:[^\p{Cc}]|[\r\n\t])*\z","Příliš žlouťoučký kůň úpěl 2 ďábelské ódy"){ } } \ No newline at end of file