Reputation: 43
In this expression below it checks for a valid email. My question is how can I check for ppl|pplweb is in the email address after the @ sign
!preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)
Thanks
Upvotes: 0
Views: 72
Reputation: 2908
you can split your $email
var in 2 components of the array separating it by the @ sign
$splitted_email = explode('@',$email);
and then search by the ppl/pp/web patterns in the first component of your array
preg_match('(/ppl|pplweb/i)',$splitted_email[1]);
this way, maybe the code is a bit longer but short regular expressions are better to mantain.
Upvotes: 1