Hi guys. I have a bit of a complicated one here. I really wish ST2 used the same regex for syntax files as its search so I could test my regex more easily than writing to the syntax file each time (if anybody knows a better way to test syntax definition matches please let me know).
Anyways… I’m trying to make a slightly complicated match here. In Oniguruma with JSON escaping it is (I believe): code[/code] although that’s not working so well for me so I could be wrong. Using the regex search, I can achieve what I want with this: \{(?:^{}]*+|(?0))*\}
But I can’t seem to get a similar result in my syntax definition file. Right now it’s only matching empty brackets: {}
While I have your attention, I should probably mention my end-goal to see if there are any alternate solutions I could explore that any of you can think of. My goal is to capture all the text between the first ‘;’ that is not between brackets and the first “:Code” following it. Essentially, detecting orphaned code which the language I’m writing this file for will interpret as a comment. I can’t simply match between the ‘;’ and ‘:Code’ because that might either match the ‘;’ in between {}'s:
@foo{bar,blah;};graaa ; asdfl
dsfsh;
:Code
or the last ‘;’:
@foo{bar,blah;};graaa ; asdfl
dsfsh;
:Code
when what I want to match is:
@foo{bar,blah;};graaa ; asdfl
dsfsh;
:Code
My current strategy has been to attempt to match the outer most parens:
@foo{bar,blah;};graaa ; asdfl
dsfsh;
:Code
And then to match from the first ‘;’ which would achieve what I want.