I’m working on Laravel 5.8. I’m trying to use Validator to validate a name field with regex, here is my rule below:

But as soon as I call the rule to be validated an error is thrown, see below:
preg_match(): No ending delimiter ‘/’ found

Solution

Since regex has a pipe in it, So, we have to use an array:

From the docs: http://laravel.com/docs/5.8/validation#rule-regex

That’s All.

Thanks for Reading.

Keep Coding.

Leave a Reply