0 votes
in JAVA by

Write a regular expression to validate a password. A password must start with an alphabet and followed by alphanumeric characters; Its length must be in between 8 to 20.

1 Answer

0 votes
by

The regular expression for the above criteria will be: ^[a-zA-Z][a-zA-Z0-9]{8,19} where ^ represents the start of the regex, [a-zA-Z] represents that the first character must be an alphabet, [a-zA-Z0-9] represents the alphanumeric character, {8,19} represents that the length of the password must be in between 8 and 20.

Related questions

0 votes
asked May 4, 2021 in JAVA by SakshiSharma
+3 votes
asked May 13, 2021 in JAVA by rajeshsharma
...