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
/
\b\d{6}(?:\d{3})?\b
/
gm
Input 1
1
New
ID 123 - it should not meet the regext as it is 3 digits ID 1234 - it should not meet the regext as it is 4 digits ID 12345 - it should not meet the regext as it is 5 digits ID 123456 - it should meet the regex it is 6 digits <========== ID 1234567 - it should not meet the regext as it is 7 digits ID 12345678 - it should not meet the regext as it is 8 digits ID 123456789 - it should meet the regext as it is 9 digits <========== ID 1234567890 - it should not meet the regext as it is 10 digits ID 12345678901 - it should not meet the regext as it is 11 digits
Extraction
ID 123 - it should not meet the regext as it is 3 digits ID 1234 - it should not meet the regext as it is 4 digits ID 12345 - it should not meet the regext as it is 5 digits ID 123456 - it should meet the regex it is 6 digits <========== ID 1234567 - it should not meet the regext as it is 7 digits ID 12345678 - it should not meet the regext as it is 8 digits ID 123456789 - it should meet the regext as it is 9 digits <========== ID 1234567890 - it should not meet the regext as it is 10 digits ID 12345678901 - it should not meet the regext as it is 11 digits