1

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 ?

badr ahrir
  • 25
  • 4
  • https://regexr.com/ Can break-down regexes and explain each section for you, quite handy –  Jul 26 '22 at 14:18

1 Answers1

0

. : 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)

Aygle
  • 41
  • 2