$100 Website Offer

Get your personal website + domain for just $100.

Limited Time Offer!

Claim Your Website Now

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.

0 0 votes
Article Rating
Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Nisha
Nisha
12 days ago

Adding automated validation tests for edge cases would make this fix more maintainable, especially when regex rules evolve during future Laravel updates.

1
0
Would love your thoughts, please comment.x
()
x