Test for valid input

This regular expression tests the input string for 40 alphanumeric characters

Regex r = new Regex(@"^[w]{1,40}$");
if (r.Match(strName).Success)
{
    // The string is ok
}
else
{
    // Invalid string
}
Share

Leave a Reply

Your email address will not be published. Required fields are marked *