I have an input string and I want to verify that it contains:
To clarify, I have 3 different cases in the code, each calling for different validation. What's the simplest way to achieve this in C#?
Only letters:
Regex.IsMatch(input, @"^[a-zA-Z]+$");
Only letters and numbers:
Regex.IsMatch(input, @"^[a-zA-Z0-9]+$");
Only letters, numbers and underscore:
Regex.IsMatch(input, @"^[a-zA-Z0-9_]+$");
1.4m articles
1.4m replys
5 comments
57.0k users