Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

basosneo's avatar

mi rule

   'last_name' => 'required|alpha|max:100',

i can't put a normal last_name. eg. Smith Stan. only Smith because intro stan and smith have a 'space' That can be changed?

Snapey's avatar

try using regex rule;

            'last_name' => [ 'Required',
                        'Regex:/^[\D]+$/i',
            'max:100'
                        ]

allows any number of non-numeric characters

basosneo's avatar

I put it in my files in the request folder? Or put them directly in the controller? Are you sure you have to wear that character ']' ? I remove the 'alpha'?

Snapey's avatar

above is the replacement rule.

because regex patterns can use a pipe | it is important to learn that you can provide a rule as an array.

If you do not want to do it this way, replace

   'last_name' => 'required|alpha|max:100',

with this

    'last_name' => 'required|Regex:/^[\D]+$/i|max:100',

Previous

Please or to participate in this conversation.