Better reghex

This commit is contained in:
honzapatCZ 2026-11-03 16:35:09 +01:00
parent feb7ed4d6c
commit 7469a4d014
3 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
namespace NejCommon.Validation; namespace NejCommon.Validation;
public class IdentifierTextAttribute : RegexAttribute{ 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"){
} }
} }

View File

@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
namespace NejCommon.Validation; namespace NejCommon.Validation;
public class StandardDescriptionAttribute : RegexAttribute{ 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."){
} }
} }

View File

@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
namespace NejCommon.Validation; namespace NejCommon.Validation;
public class StandardTextAttribute : RegexAttribute{ 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"){
} }
} }