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-]{5})(?>\d+-*|-{5})[A-Z\d_]*$
/
gm
Input 1
1
New
12345ABC 12345123 1234-1 1234--1 1----1AB 123---- ----- 123A---- -2-2- 1AAAAAA 1-2-3-A ----1AB --1--1A
Extraction
12345ABC 12345123 1234-1 1234--1 1----1AB 123---- ----- 123A---- -2-2- 1AAAAAA 1-2-3-A ----1AB --1--1A