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
r"
\[(?:\\.|[^]\\])*]
"
g
Input 1
1
New
[abc] [1-9\n\t] [ \t\]] [\\\]] [[\\\\\\\]] The square brackets cannot be nested, by example in [[]], we want to match [[]. Although, since a \] indicate an escaped bracket, we need to skip those. But a pattern such as \\] must be accepted. The following would not be matched. [\] [\\\] [abc\\\]
Extraction
[abc] [1-9\n\t] [ \t\]] [\\\]] [[\\\\\\\]] The square brackets cannot be nested, by example in [[]], we want to match [[]. Although, since a \] indicate an escaped bracket, we need to skip those. But a pattern such as \\] must be accepted. The following would not be matched. [\] [\\\] [abc\\\]