Return to site
· Password validation,Rules,Web Development,web applications,Laravel
broken image

If you want to check if the password contains the following categories:

English uppercase characters (A – Z)

English lowercase characters (a – z)

Base 10 digits (0 – 9)

Non-alphanumeric (For example: !, $, #, or %)

Unicode characters

Create a regular expression first. It would look like this:

Then use it in the code . The Laravel code will be like given below:

               min:6|

               regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\X])(?=.*[!$#%]).*$/|

               confirmed',

For Laravel 5.6 the laravel code will be:

               'min:6', 

               'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\X])(?=.*[!$#%]).*$/', 

               'confirmed']Read more