If you want to restrict the username in Laravel to only accept letters, numbers, dashes and underscores and not space inside “the username string” you have some options :
Option A:
You should simply put this regex in the validation method like:
Option B:
alpha_dash is a default Laravel validation rule which allows letters, numbers, dashes and underscores and NOT space.
When you implement alpha_dash rule, the field under validation may have alpha-numeric characters, as well as dashes and underscores.