Verifying that a string contains only letters in C# -
I have an input string and I want to verify that this is in:
- Only letters or numbers
- letters and numbers only
- letters, numbers or underscores only
To clarify, I have 3 in the code There are different cases Calling for different verification What is the easiest way to get it in C #?
characters only:
Rexax. IS match (input, @ "^ [a-ja-jade] + $");
Only letters and numbers:
Regex.IsMatch (Input, @ "^ [a-zA-Z0-9] + $");
Only letters, numbers, and underscores:
Reggae. IS Match (input, @ "^ [A-GAA-G-0-9 _] + $");
Comments
Post a Comment