I have this requirement for checking characters, numbers, and a few special characters from a given user input. The input may have AZ, az, 0-9,.,? And>. It must not have any other special character.
If there is one entrance, he should stop there and make another staff. I tried to write a regular expression like this (below), but it always gives false information - I don't know what is missing:
string[] vals = allParams.Split(':'); Regex rgx = new Regex(@"^[a-zA-Z0-9?>.]$"); foreach (string value in vals) { string result = rgx.IsMatch(value).ToString(); if (result == "False") return; }
source share