Trying to create custom email validation for below rules
- The local part can be up to 64 characters in length and consist of any combination of alphabetic characters, digits, or any of the following special characters: ! # $ % & ‘ * + – / = ? ^ _ ` . { | } ~
- The period character (".") is valid for the local part subject to the following restrictions: A. it is not the first or last character B. two or more consecutive periods
- top level domains cannot be all numeric
- hyphens cannot be the first or last character
^([a-zA-Z0-9!#\$%&‘*+/\=\?\^_'`}{\|~-][.]?)@[a-zA-Z0-9]+(?:(.)\0?(?!\1))[a-zA-Z0-9-]*[a-zA-Z0-9]+(.[a-zA-Z0-9]{2,63})+$
First part (before @ )is good but unable to place
- two or more consecutive periods
hyphens cannot be the first or last character
for example
- leela.test@te-st.gm-ail.com(correct)
- leela.test@te-st..gm-ail.com(incorrect)
- leela.test@.te-st.gm-ail.com(incorrect)
- leela.test@-te-st.gm-ail-.com(incorrect)
- leela.test@.te-st.gm-ail-.com(incorrect)
- leela.test@test.gmail.com(correct)
- leela@gmail.com(correct)
- leela@test.gm-ail.com(correct)
Please help.