Index: DamEngine/trunk/src/Deltares.DamEngine.Io/IdValidator.cs =================================================================== diff -u -r4000 -r4052 --- DamEngine/trunk/src/Deltares.DamEngine.Io/IdValidator.cs (.../IdValidator.cs) (revision 4000) +++ DamEngine/trunk/src/Deltares.DamEngine.Io/IdValidator.cs (.../IdValidator.cs) (revision 4052) @@ -21,26 +21,25 @@ using System.Text.RegularExpressions; -namespace Deltares.DamEngine.Io +namespace Deltares.DamEngine.Io; + +/// Validator for Id names +public static class IdValidator { - /// Validator for Id names - public static class IdValidator + /// Checks if Id contains only valid characters + /// Valid characters are (between quotes): + /// "ABCDEFGHIJKLMNOPQRSTUVWXYZ" // Specified as "A-Z" + /// "abcdefghijklmnopqrstuvwxyz" // Specified as "a-z" + /// "01234567879" // Specified as "0-9" + /// "!#$%&()*+,-./" // Specified as "!#-/" + /// ":;<=>?@" // Specified as ":-@" + /// "[\]^_`" // Specified as "[-`" + /// "{|}~ " // Specified as "{-~ " + /// " " // Specified as "\s" + /// Name to check + static public bool IsCorrectName(string name) { - /// Checks if Id contains only valid characters - /// Valid characters are (between quotes): - /// "ABCDEFGHIJKLMNOPQRSTUVWXYZ" // Specified as "A-Z" - /// "abcdefghijklmnopqrstuvwxyz" // Specified as "a-z" - /// "01234567879" // Specified as "0-9" - /// "!#$%&()*+,-./" // Specified as "!#-/" - /// ":;<=>?@" // Specified as ":-@" - /// "[\]^_`" // Specified as "[-`" - /// "{|}~ " // Specified as "{-~ " - /// " " // Specified as "\s" - /// Name to check - static public bool IsCorrectName(string name) - { - var regex = new Regex(@"[^A-Za-z0-9!#-/:-@[-`{-~\s]"); - return !regex.IsMatch(name); - } + var regex = new Regex(@"[^A-Za-z0-9!#-/:-@[-`{-~\s]"); + return !regex.IsMatch(name); } } \ No newline at end of file