public bool IsAlphaNumericWithUnderscore(string input) { return Regex.IsMatch(input, "^[a-zA-Z0-9_]+$"); }
bool result = input.All(c=>Char.IsLetterOrDigit(c) || c=='_');
var regExp = new Regex("[a-zA-Z]+_[a-zA-Z]+"); Match match = regExp.Match(UserName); if (!match.Success) { //Invalidate. //return }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)