I need a little help with my syntax definition for a custom language. In the language there are elements within a body of text that look like this:
[double bracket]]
[single bracket]
In my definition file I use begin and end captures for these elements and then apply different highlighting to them and the stuff inside. The issue I’m having is that my regex is picking up the single square bracket elements first and ignoring the double square bracket elements. The regex for the single brackets is:
<key>begin</key>
<string>(\)</string>
<key>end</key>
<string>(\])</string>
The regex for the double brackets is:
<key>begin</key>
<string>(\\)</string>
<key>end</key>
<string>(\]\])</string>
Using the following regex for the begin of the single bracket lets the double bracket work, but it automatically picks up the second matched character as part of the group when I would expect it not to.
(\)^\]
I modified the regex to use a non capture group for the second character, but it still matches the second character.
(\)(?:^\])
I’m wondering if there is something I can do to get these to match properly.