The title says all, I am trying to match all {
and }
but not those included in {0}
or {1}
.
Ex: {asd } {2} asds}w2{1}
Here, all brackets would match but the last 2.
Edited based on comments:
Here you go:
(?!\{[01]\})\{|(?<!\{[01])\}
Explanation:
{
if what follows is not {0}
or {1}
. }
if what precedes is not {0
or {1
. The matches in the following sample are bolded:
{ asd } { 2 } asds } w2{1} { foo } {0} { bar } } { { }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.