I'm new to using Regular Expressions, but I'm trying to use them for form validation. Everything's going fine so far, except for names that contain an apostrophe (i.e. O'Dell).
This article
http://msdn.microsoft.com/library/de...aght000001.asp, states that this code:
Regex.IsMatch(fname_form, "^[a-zA-Z'.\s]{1,40}$")
"...constrains an input name field to alphabetic characters (lowercase and uppercase), space characters, the single quotation mark (or apostrophe) for names such as O'Dell, and the period or dot character. In addition, the field length is constrained to 40 characters.".
But I'm getting this error when attempting to enter a name with an apostrophe:
Expected token 'eof' found 'NAME'. 'o'-->dell<--'
Huh? If anyone can let me know what I'm doing wrong, that would be great. Thanks.
KWilliams