I’m creating a form in PHP that contains a field called email where the user needs to enter his/her email ID. In order to ensure that the mail ID entered is authentic in terms of syntax (eg. username_123@domain.com is valid) I need to append some kind of validation to it. I find the situation quite nebulous as I don’t understand how to check if the mail ID entered contains an @ symbol etc. Kindly help. Thanks. 🙂
I’m creating a form in PHP that contains a field called email where the
Share
Best solution is to just do:
and let PHP handle the heavy work for you. Otherwise, if you want to be strictly correct and use a regex directly yourself, you’ll be stuck with this monstrosity:
for strict RFC2822 compliance.