Reputation: 321
I am trying to validate a field made up of letters, numbers and spaces in this way:
$rules = array(
'field'=> 'regex:/([A-Za-z0-9 ])+/'
);
but if I try to insert characters like ' " and others, the validation still has to be successful.
What's wrong 'in my regular expression?
Upvotes: 2
Views: 25580
Reputation: 101
If you are working with utf-8
$rules = array(
'field'=> 'regex:/(^[\pL0-9 ]+$/u'
);
Upvotes: 3