From 6f0f94a35474084a94208e53a9d7b9653c749046 Mon Sep 17 00:00:00 2001 From: ruri Date: Tue, 28 May 2019 18:08:39 +0200 Subject: [PATCH] Added MustMatchRegex to the DataRules. --- RuriLib/Models/CData.cs | 4 ++++ RuriLib/Models/DataRule.cs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RuriLib/Models/CData.cs b/RuriLib/Models/CData.cs index 02f1e00..4d730e0 100644 --- a/RuriLib/Models/CData.cs +++ b/RuriLib/Models/CData.cs @@ -83,6 +83,10 @@ namespace RuriLib.Models case RuleType.MustNotContain: valid = !CheckContains(slice, rule.RuleString); break; + + case RuleType.MustMatchRegex: + valid = Regex.Match(slice, rule.RuleString).Success; + break; } if (!valid) return false; diff --git a/RuriLib/Models/DataRule.cs b/RuriLib/Models/DataRule.cs index 2158bd8..17ab179 100644 --- a/RuriLib/Models/DataRule.cs +++ b/RuriLib/Models/DataRule.cs @@ -23,7 +23,10 @@ namespace RuriLib.Models MinLength, /// The slice's length must be smaller or equal to a given number. - MaxLength + MaxLength, + + /// The slice must match a given regex pattern. + MustMatchRegex } ///