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
/
\[(.+?)(?<!(?<!\\)\\{2})\]
/
mg
Input 1
New
+------------------+----------------+ | Input | Output | +------------------+----------------+ | [B] | B | | [B][C][D] | B | | [hello\t\tworld] | hello\t\tworld | | [hello\n\nworld] | hello\n\nworld | | [\\]] | \\] | | [\\\\] | \\\\ | | [x[y\\]z][foo] | x[y\\]z | +------------------+----------------+
Substitution
+------------------+----------------+ | Input | Output | +------------------+----------------+ | [B] | B | | [B][C][D] | B | | [hello\t\tworld] | hello\t\tworld | | [hello\n\nworld] | hello\n\nworld | | [\\]] | \\] | | [\\\\] | \\\\ | | [x[y\\]z][foo] | x[y\\]z | +------------------+----------------+