Reputation: 25
I've got an small form to download some stuff. But I don't want every buddy to download it. Only from 2 specific domains you can download the stuff. So I made an form with an email validation. But How can I add two Domains in the test of the email? What I was trying was:
$test = array(
'email' => '/^[\w.+-]{2,}\@[DOMAIN1][DOMAIN2]\.[a-z]{2,6}$/',
}
But that didn't worked …
Thanks for any help.
Upvotes: 1
Views: 106
Reputation: 67898
By grouping the evaluation ()
and placing an or operator in it |
you'll be able to handle either domain. See the below modified regex:
'email' => '/^[\w.+-]{2,}\@(DOMAIN1|DOMAIN2)\.[a-z]{2,6}$/',
Upvotes: 2