public static void Main()
{
//
// Get the input
//
string inputString="aA";
Console.WriteLine(IsValid(inputString));
Console.ReadLine();
}
//
// This function validates the input
//
static bool IsValid(string s){
//
// Create a regex
//
Regex r = new Regex(@"^[0-9a-z]*$");
//
// Check if the input matches
//
return r.IsMatch(s);
}
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.