Need to validate email address with single domain level or multi level domains.(actually domain level <=4)
Criteria:
- Email (username) should start with letter[a-z] and it may have numbers but not for 1st letter and periods(.) No other characters.
- After @ sign every domain should start with letter.(minimum length 2)
- Maximum domains <= 4 .
above example there 4 domains;
- .my
- .sub
- .com
I try with this RegEx:
^[a-zA-Z](:?[a-zA-Z0-9._-])+(@[a-zA-Z]+[a-zA-Z0-9_-])+\.+(([a-zA-Z]){2,6})$
But above regex not validating multiple domains correctly.It's only get 1 domain. Ex: [email protected]
Online Regex : https://regex101.com/r/7SXS1Z/1
^[a-zA-Z][a-zA-Z0-9._-]+@(?:[a-zA-Z][a-zA-Z0-9_-]+\.){1,4}[a-zA-Z]{2,6}$
– Wiktor Stribiżewfilter_var()
withFILTER_VALIDATE_EMAIL
??? – AbraCadaver