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
/
^foo ([abc])(?: (?!\1)((?1))(?: (?!\1|\2)(?1))?)?$
/
gm
Input 1
1
New
foo a b c foo b c a foo a b foo b foo b b foo a b foo a b a
Extraction
foo a b c foo b c a foo a b foo b foo b b foo a b foo a b a