This is my text:
This [is] some [d[um]my] text. How to [se[le]ct i[nn]er b]race wi[th[out s]ele[ct]ing th]e outer b[race [in] a tex]t
The regex for the above text which is required must be highlighted as below
This [is] s[o]me [d
[um]
my] text. How to [se[le]
ct i[nn]
er b]race wi[th[out s]
ele[ct]
ing th]e outer b[race[in]
a tex]t
As you can see, the regex must highlight only the braces which has parent braces. The braces which do not have parent braces must not be selected.
For example [is] and s[o]me has no parent brace hence they must not be highlighted. But [d[um]
my], [se[le]
ct i[nn]
er b]race have parent brace hence the brackets along with the text inside must be selected.
I have tried the below PCRE regex:
\[[^\[]+?]
https://regex101.com/r/xR0wM3/12
But it is also highlighting the braces which do not have outer brace. That is the only issue to be solved, all the other highlighting of text is working perfectly. In the example provided the change must be made such that it must not select the braces which do not have parent brace. i.e, in the example [is]
is being selecting which is out of scope of the requirement. If this is solved then my requirement is completed.