I have the following in C#:
public static bool IsAlphaAndNumeric(string s) { return Regex.IsMatch(s, @\"[a-zA-Z]+\") && Regex.IsMatch(s,
private static readonly Regex _regex = new Regex( @"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$", RegexOptions.Compiled); public static bool IsAlphaAndNumeric(string s) { return _regex.IsMatch(s); }
If you want to ignore case you could use RegexOptions.Compiled | RegexOptions.IgnoreCase.
RegexOptions.Compiled | RegexOptions.IgnoreCase