I have a regular expression to validate an email address. It supports trailing and leading spaces, since I want to allow users to make that mistake, I'll just trim the email value on the backend. This logic is exactly what I want.
This is the regular expression I have right now: \s*[-+.'\w]+@[-.\w]+\.[-.\w]+\s*
However, my current expression also allows ``` and ,
characters in the email address. How can I make sure that only characters valid for an email address are supported, but also allow trailing or leading spaces?
So these addresses are currently allowed, which I don't want:
dfdfd@bcvb.com,
dfdfd@bcvb.com`