mardi 26 novembre 2019

Laravel validation username must not start with specific string

I want to register user but I want to put validation rule on username that username should not start with special characters and also should not start with web. I found regex that work fine special characters but detect the string it give me error of Invalid format

return [
          'username' => [
                    'required',
                    'regex:/^\S*$/u',
                    'regex:/^[_]?[a-zA-Z0-9]+([_.-]?[a-zA-Z0-9])*$/',
                    'unique:users'
                ],
          'full_name' => 'required',
       ];


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire