i find some difficulties to understand this regular expression that i want toCreate A Password Validation Form in my registration page :
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"?
and olso why we put this character "?=.*" every time in this regular expression ? and what that means ?
CodePudding user response:
. : represent ONE character it can be any type of character but it s ONE
.. : represents TWO char ...
* : means 0 or more
.* : means expression 0 or more character
?= : https://stackoverflow.com/a/1570916/18266788
What it does : pattern="(?=.\d)(?=.[a-z])(?=.*[A-Z]).{8,}"
First it checks if there are numbers (represented by (?=.*\d))
Checks if there are lower (?=.*[a-z])
same for upper (?=.*[A-Z]).
Then "Add" these 3 check/match if length above 8 (.{8,})
(correct me if i'm wrong or not precise but i explained in my own word)