amit123
178
3
Laravel

regex in validator rules

Posted 1 year ago by amit123

hello,

Something is wrong with my regex in Laravel a username should only include uppercase letters, lowercase letters and numbers.

public function rules()

{

    return [

        'name' => [

                    'required',

                    'unique:users,name',

                    'min:10',

                    'regex:/[a-z{1}A-Z{1}0-9{1}]+/',

                 ]

    ];

}

According to this site it actually should work: https://regexr.com/

hope you guys could help me again

thanks Amit

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.