I have a Card Holder Name TextBox in MVC. I want to write Regular Expression for the same. So I want to allow UpperCase, space and numeric letters.
Name Format- "First Name" space "Last Name" e.g. JOHN METHEW10. "First Name" space "Middle Name" space "Last Name" e.g. CHRIS HENRY GAYLE
Space will be allowed only between words, not in other places.
I have written, But its not working properly.
[RegularExpression(@"([0-9A-Z]+[\s][0-9A-Z]+)", ErrorMessage="Invalid Card Holder Name")]
public string NameOnCard
{
get
{
return m_strNameOnCard;
}
set
{
m_strNameOnCard = value;
}
}
I have modified the Regex.. not Im facing one issue, all is working fine. except one case. It should not allow multiple spaces between words.