3

I have this regex pattern: /^[\p{L}\p{M}\p{N}\d\s\,-]+$/u.

When I try to validate any string for topics which can hold ü,ö,ä,ə,ç... with Laravel's Validator then it doesn't match. But when I use this regex outside of Laravel's Validator then it works as expected.

This is my validator function:

$validator = Validator::make($request->all(), [
    'type' => 'required',
    'internal_name' => 'required|min:3|max:255|unique:news',
    'topics' => 'max:255|regex:/^[\p{L}\p{M}\p{N}\d\s\,-]+$/u', <--- here is the problem
    'description' => 'required',
    'body' => 'required'
]);

I have searched if there is any problem with Laravel, but couldn't find anything.

Dharman
  • 30,962
  • 25
  • 85
  • 135
MRustamzade
  • 1,425
  • 14
  • 27
  • 1
    Does this answer your question? [Laravel 5.4 - Validation with Regex](https://stackoverflow.com/questions/42577045/laravel-5-4-validation-with-regex) – ArSeN Feb 22 '20 at 19:35
  • @ArSeN no :( I have tried to solve it that way, but unsuccessfully. – MRustamzade Feb 23 '20 at 09:25

0 Answers0