# % { } | \ ^ ~ [ ] `") in my password using rest api laravel. example : <<@dmin91. my ..." /> # % { } | \ ^ ~ [ ] `") in my password using rest api laravel. example : <<@dmin91. my ..."> # % { } | \ ^ ~ [ ] `") in my password using rest api laravel. example : <<@dmin91. my ...">
Ad

Unsafe Character In Password Rest Api False

How to handling unsafe character ( " < > # % { } | \ ^ ~ [ ] `") in my password using rest api laravel. example : <<@Dmin91. my authenticate attempt always get false in return.

Ad

Answer

Use Regular expression to allow special characters

^.(?=.{3,})(?=.[a-zA-Z])(?=.[0-9])(?=.[\d\x])(?=.[!$#%]).$

E.g.

'password' => 'required| min:6|
           regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\X])(?=.*[!$#%]).*$/|
           confirmed',
Ad
source: stackoverflow.com
Ad