Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
^(?=[^A-Z\n]*[A-Z][^A-Z\n]*$)(?=[^a-z\n]*[a-z][^a-z\n]*$)(?=(?:[^\d\n]*\d){6}[^\d\n]*$)[a-zA-Z0-9]{8}$
/
gm
Input 1
1
New
I have to match an 8 character string, which can contain exactly 2 letters (1 uppercase and 1 lowercase), and exactly 6 digits, but they can be permutated arbitrarily. So, basically: would pass K82v6686 3w28E020 would fail (too long) would fail (three letters) would fail (two capital letters) 1276eQ900 98Y78k9k A09B2197
Substitution