I want to check a comma separated email addresses with regex
in Laravel 5.1 validation and I have created below regex
for email but it is not working for me.
regex: /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i
I want to allow email like this: test1test.com, test2@test.com, test3@test.com
Here is my validation example code:
$rules = array(
'email' => 'regex:/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i',
);
$messages = [
'email.regex' => 'Please enter valid Email.',
];
$validator = Validator::make(Input::all(), $rules, $messages);
if ($validator->fails()) {
} else {
}