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-9]+)?(,|$))+)$
/
gm
Input 1
1
New
1,2,3-5,6 1,2,3-5,6, 1 1-3 ,1,2,3 23,25-89,99 23,12,3-5,15 1,2,3-,4,5-7 1,2,3-,4,5-7, 1,2,-3,4,5 1,2,-,3,4 1,2,,,3,4 1a2-2aoe
Substitution
1,2,3-5,6 1,2,3-5,6, 1 1-3 ,1,2,3 23,25-89,99 23,12,3-5,15 1,2,3-,4,5-7 1,2,3-,4,5-7, 1,2,-3,4,5 1,2,-,3,4 1,2,,,3,4 1a2-2aoe