I've looked on here for some ideas but I still seem to be struggling with coming up with a regular expression to meet my requirements.
I need a regular expression to check a password format, the criteria are:
- At least 1 uppercase letter
- At least 1 number
- Only alphanumeric characters (no special characters)
- At least 8 characters long
The regular expression I'm using is:
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$
However this is also allowing characters like !$&
.
Is there a modification I need to make to this to get it to stop these special characters being accepted?