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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -