For PHP what is the best email validation using preg, NOT ereg because it’s deprecated/removed.
I don’t need to check if the website exists (it’s not like maximum security).
I’ve found many ways with ereg but they (obviously) aren’t good practice.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I suggest you use the
FILTER_VALIDATE_EMAILfilter:You can also use its regular expression directly:
But in that case, if a bug is found in the regular expression, you’ll have to update your program instead of just updating PHP.