Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
([A-Z]+)\d+-\1\d+|(?!.*-)^.*$
/
gm
Input 1
1
New
E1-E9 E1-E1 E1-E99 A1-A999 AB5-AB77 A1-B9 E1-EE9 E1 1EE E1 AB9 4CD
Substitution