I came across this regex used for password validation:
(?=.*[a-z])(?=.*[A-Z])(?=.*[\d])(?=.*[^a-zA-Z\d])(?=\S+$).{8,}
There are only two things that are unclear to me about this regex:
what are
.*
used for and why this regex doesn't work without them?what is the difference/benefit or using
[\d]
instead of\d
, because the regex works just fine in both cases