How can I modify this regex for email? Current my regex does not allow for an apostrophe:
"^[A-Za-z0-9_\\-\\.]+[@]([A-Za-z0-9\\-\\.]+)+[\\.]([A-Za-z]{2,4})$";
Now I want add apostrophe, however the request is to only allowed 1 apostrophe before @ symbol.
I tried to use this:
"^([A-Za-z0-9_\\-\\.]+[']{0,1})+[@]([A-Za-z0-9\\-\\.]+)+[\\.]([A-Za-z]{2,4})$";
It allows apostrophe input, however I can input more than 1 apostrophe before @ symbol
Result:
test''test@yahoo.com
-> not allowed
test'tes't@yahoo.com
-> allowed (expected not allowed)
Expected result is that only one apostrophe is allowed before @ symbol.