regex - Validate email address using javascript -


here's code i'm using validate email address on clicking submit button user,

/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailid); 

i allow apostrophe(') email address entered user, modification regex above?

try this:

/^(\w|')+([\.-]?(\w|')+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/ 

it allow apostrophe anywhere before '@'


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -