here's the code that I'm using to validate email address on clicking submit button by the user,
/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(EmailID);
I would like to allow apostrophe(') to the email address entered by the user, what would be the modification for the regex above?
try this:
/^(\w|')+([\.-]?(\w|')+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
it will allow apostrophe anywhere before the '@'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With