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
`
^XYZ\/(?:ALL|P?[0-9]+(?:-[0-9]+)?(?:,[0-9]+(?:-[0-9]+)?)*)$
`
gm
Input 1
1
New
XYZ/1 XYZ/1,2-5 XYZ/5,7,8-9 XYZ/2-4,6-8,9 XYZ/ALL XYZ/P1 XYZ/P2,3 XYZ/P4,5-7 XYZ/P1-4,5-7,8-9
Substitution