regex - Pattern matching for characters, comma and semicolon -
i trying pattern match against textbox input field.
the entered text should consist of characters separated ',' or ';' followed optional space.
example: jane, doe
, jane,doe
, jane,doe; jack,black
, jane,doe;jack,black
valid. jane doe
, (leading space)jane
, doe(trailing space)
invalid.
the current pattern have is, /^[a-za-z]+(,;)?$/
please help.
how this:
/^[a-za-z]+([,;]\s?[a-za-z]+)*$/
Comments
Post a Comment