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
/
^(?:[0-9]{0,4}|[0-9]{6,})$
/
gm
Input 1
New
1 12 123 1234 12345 <-- only one it should not match 123456 1234567
Extraction
1 12 123 1234 12345 <-- only one it should not match 123456 1234567