I’m using java.util.regex.Pattern to match passwords that meet the following criteria:
- At least 7 characters
- Must consist of only letters and digits
- At least one letter and at least one digit
I have 1 & 2 covered, but I can’t think of how to do 3.
1 & 2 – [\\w]{7,}
Any ideas?
You can use this. This basically uses lookahead for achieving the 3rd requirement.
or the Java string
Explanation
Edit
If you want to include unicode letter support, then use this