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
/
(?:\G(?!^)|\()[^)(]*+\K(\(((?>[^)(]+|(?1))*)\))
/
gm
Input 1
New
Record ID What is the best food? (choice=Nachos) What is the best food? (choice=Tacos (big bent nachos)) What is the best food? (choice=Chips with stuff) Complete? So ((this) one (has) (many) (inside)) (none here) (but (here) and (here)) Deeper nesting: (l0 (l1 (l2) l1 (l2) l1)) out (a (b) (b) a ((c) b)) out (no)
Substitution
$2
Record ID What is the best food? (choice=Nachos) What is the best food? (choice=Tacos (big bent nachos)) What is the best food? (choice=Chips with stuff) Complete? So ((this) one (has) (many) (inside)) (none here) (but (here) and (here)) Deeper nesting: (l0 (l1 (l2) l1 (l2) l1)) out (a (b) (b) a ((c) b)) out (no)