Showing posts with label Validate String length. Show all posts
Showing posts with label Validate String length. Show all posts

Tuesday, September 2, 2008

Validate String max length using Reguler Expression in C#

class Program
{
static void Main(string[] args)
{
if (Regex.IsMatch("[Input String]","^.{4,20}$" ))
{
Console.WriteLine("true");
}
else
{
Console.WriteLine("false");
}
Console.ReadLine();
}
}