regex for password

Asked

Viewed 46 times

0

I would like to know how to make a regex that contains at least 8 digits being mandatory 1 digit with @!# 1 digit in capital letters and a digit with numerals from 0 to 9

tried something with the https://regex101.com/ but all I could get was :

([0-9]{1}[!@#]{1}[a-zA-Z]){8,}

very grateful if you can help me :)

  • You already have something similar here, here and here

  • 1

    Man, thanks! I got the problem solved! @hkotsubo

  • Only one Obs.: no uppercase digit. There is "uppercase letter". : D

  • yes, but I took the pattern and corrected!

  • got that way: ^(?=.[0-9])(?=.[A-Z])(?=. *[@! #])[a-zA-Z0-9@! #]{8,}$

  • A tip for future regex you will use: {1} it is not necessary, therefore [0-9]{1} is the same as [0-9] - in fact, (qualquer coisa){1} is the same as (qualquer coisa)

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.