Regular expression to verify that a string contains between 1 and 40

Regex r = new Regex(@"^[\w]{1,40}$");
       
if (r.Match(strName).Success)
{
    // Valid
}
else
{
    // Not Valid
}

Comments

Popular posts from this blog

Convert XElement to DataTable

Enable mouse scroll-wheel in VB6

C# code to Check IE Proxy Settings