Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Regular
Expressions
101
Regular
Expressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
^(?:(?:\d+(?:-\d+)?),?)+$
/
gm
Test String
New
1 1-2 1,23,1-4,5,23,123 1,2,3,4,5,6-10 1,123-123,4,1,66,123 1-2,2-3,3-4,4-5,6-7,8,9,10
Extraction
Processing...