static final Pattern PASSWORD_PATTERN = Pattern.compile("((?=.*\\d)(?=.*[a-z])(?=.*[!@#$%^&*]).{5,10})"); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

static final Pattern PASSWORD_PATTERN = Pattern.compile("((?=.*\\d)(?=.*[a-z])(?=.*[!@#$%^&*]).{5,10})");

Could anyone explain me it briefly..

9th Feb 2020, 2:00 PM
Shubham
Shubham - avatar
1 Answer
0
The text you check against this pattern must contain at least one of the special characters !@#$%^&* and the characters \d and the text must have al least 5 characters. The return will be the first 5 to 10 characters, as many as it will find. For more info you could test your pattern on regex101.com
9th Feb 2020, 3:01 PM
Gabriel Ilie
Gabriel Ilie - avatar