Here you go:
^(?=(?:[az]*\d){3})(?=(?:\d*[az]){3})\w{6}$
http://regex101.com/r/hO5jY9
If there are at least three digits, at least three letters and no more than six characters, the string must match.
How it works?
- This is a classic regex for password validation.
- Two glances verify that we have at least three numbers and at least three letters.
- After these statements, we can match any 6 characters with
\w{6} to the end of the line
Views
Let me break the first glance: (?=(?:[az]*\d){3})
He claims that three times ( {3} ) in this position in the line, which is the beginning of the line, as indicated by ^ , we can match any number of letters followed by one digit. This means that there must be at least three digits.
zx81
source share