I’m trying to block all email providers except some of theme,
PHP code:
$hostings = "/@yahoo|@gmail|@msn/";
if(!preg_match($hostings, $email))
$stop .= "Invalid Email Provider";
Problem is, i can’t use capital letters! for example i cant use this email:
Gmail.com
How i can fix that?
You need the
/imodifier to make your regex case-insensitive.(You could also compare
strtolower($email)against your regex.)Finally, I suggest you hoist the
@so you have/@(yahoo|gmail|msn)/.Edit: Combined, your regex looks like this:
/@(yahoo|gmail|msn)/i.