Home > Software engineering >  How to make a regular expression based on this criterion?
How to make a regular expression based on this criterion?

Time:06-02

My password should be: alphanumeric characters (uppercase and lowercase English letters, numbers, and symbols such as @, #, * and &)

How do make a regular expression for such rules?

I tried: ^\\s*[a-zA-Z0-9_\\-\\.]*\\s*$

The value that gives the error: 45a$ and 1a@

CodePudding user response:

try this

[A-Za-z0-9@#\*&]*
  • Related