Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ValidationRules = new Dictionary<string, string>()
- {
- { "FirstName", @".{3,50}"},
- { "SecondName", @".{3,50}"},
- { "Email", @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"},
- { "Date", @"([0-3][0-9])\. (0[0-9]|1[0-2])\. ([0-9][0-9][0-9][0-9])"},
- { "City", @".{2,100}"},
- { "Passwd", @"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$"}
- };
- /// <summary>
- /// validacni funkce
- /// </summary>
- /// <param name="value"></param>
- /// <param name="validationRule"></param>
- /// <returns>return true - if is valid</returns>
- public static bool Validate(string value, string validationRule)
- {
- Regex rgx = new Regex(validationRule);
- return rgx.IsMatch(value);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement