mercredi 5 août 2015

How to make preg_match PHP function match domain in email address format?


Below is the part of the script that needs modifying. Currently it will match any word directly after the @ in the email address supplied by the user. I need it to be able to match any word either directly after the @ or with another word and dot (.) preceding, example: user@domain.com should match domain, user@someword.domain.com should also match domain regardless of the .someword in front (which changes user to user and is there for some but not others.

PHP CODE:

preg_match('|@([0-9a-zA-Z]+)\.|i', $username, $match);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire