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
/
(?>(?<=class=")|(?!^)\G)(?>\b([-\w]++)\b(?=[^"]*?\s\1[\s"])\s+|[-\w]+\s+\K)
/
g
Input 1
1
New
<li class="a-b a-c 3 2 1 is it this or this is it or it is this 1 2 3 a-c a-b">
Substitution
<li class="a-b a-c 3 2 1 is it this or this is it or it is this 1 2 3 a-c a-b">