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
/
^(?:\d{4}|\d{6})$
/
gm
Input 1
New
1 12 123 12345 1234567 -1234 1.234 -1.234 00000000 1234 0000 1111 123456 098765 000000 123456 090909
Substitution
1 12 123 12345 1234567 -1234 1.234 -1.234 00000000 1234 0000 1111 123456 098765 000000 123456 090909