Reputation: 297
I am trying to pattern match against a textbox input field.
The entered text should consist of only characters separated by a ',' or a ';' followed by an optional space.
Example: Jane, Doe
, Jane,Doe
, Jane,Doe; Jack,Black
and Jane,Doe;Jack,Black
are valid. But Jane Doe
, (leading space)Jane
and Doe(trailing space)
are invalid.
The current pattern I have is,
/^[A-Za-z]+(,;)?$/
Please help.
Upvotes: 0
Views: 718