I have used the following code but it is returning false though it should return true
string check,zipcode;
zipcode=\"10001 New York, NY\";
check=isalpha
When the ^ is in the [ ] it means everything but these characters.
Back in my perl days, I would have used this regular expression:
\w+
which means one or more word character. A word character is basically a-zA-Z0-9 and basically does not care about punctuation or spaces. So if you just want to make sure that there is someting of value in the string, this is what I have used in C#:
public static Boolean isAlphaNumeric(string strToCheck)
{
Regex rg = new Regex(@"\w+");
return rg.IsMatch(strToCheck);
}
Thanks to Chopikadze for the basic structure.
I do think that this one would be faster since instead of checking through the entire string, it would stop at the first instance of a word character and return a true.