Laravel regex validation not working

I just started using laravel and I am working on validating textarea in one of my forms.

The text box is intended for users, so I want only letters, numbers, spaces and the following characters:,.?;: '"- ()! / @ $

This is what I have

$validator = Validator::make(Input::all(), array('bio' => array('regex:[a-zA-Z0-9 ,\.\?;:\'"-\(\)!/@\$]') ) ); 

I searched and tried a lot to make it work, but I just can’t understand.

Any help would be greatly appreciated.

thanks

+8
php regex validation forms laravel
source share
1 answer

Try the following:

 array('Regex:/^[A-Za-z0-9\-! ,\'\"\/@\.:\(\)]+$/') 
+17
source share

All Articles