I am currently trying to write a regex code for the following rules in my javascript.
- E-mail address must be a valid address ( X @ Y . Z )
- Allowed characters for the name part is uppercase and lowercase a-z, digits, dash and dot characters
- Allowed characters for the domain part is only letters and dot (.).
How could I write whole cases in one regular expression?
What I did so far is /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
Thanks in advance.