I have rules for password, the rules is:
Only alphanumeric characters, spaces, dashes, periods, and underscores are allowed.
in Users model i use validation like bellow
'password'=>array('required', 'min:8', 'max:20', 'regex:[A-Za-z\s\-\._]')
when the form submitted, it throw error The password format is invalid.
. what could be wrong with my regex?
PS: i input 12345678 in password field.
You're not including numerical characters in your regexp.
You should add 0-9
, this gives : regex:[A-Za-z0-9\s\-\._]'