Given:
"abc{defghij{kl}mnopqrst}uvwxyz{aaaaaaaaaa}"
I want to match the text between the characters {
and the last }
excluding nesting - i.e. the texts {defghij{kl}mnopqrst}
and {aaaaaaaaaa}
.
Without the nested {kl}
, the regex expression \{[^{}]*\}
works just fine. But not with the nested {kl}
.
Is there a way to do this? If not possible, can I say "match text between { and } where the size of the enclosed text is at least, e.g. 3, characters so that the nested {kl} which contains two characters is not matched? (I'm assuming one level nesting)
Editor: https://www.freeformatter.com/java-regex-tester.html
Thanks,