Sublime Forum

Recursive Regex Syntax Highlighting

#1

Hello,

I am attempting to create a snippet in my syntax file to highlight SAS macrovariables. These are structures that are effectively balanced parentheses, where ( = & and ) = ., and there can be digits and letters and underscores.

For example: &&my&variable…_01
The regex would match &&my&variable…

I have a regex that does this when I search: &(?:\w*|(?0))*.

When i try to put this in the syntax file as &(?:\w*|(?0))*.

I get the following error: Error in regex: undefined group option in regex &(?:\w*|(?0))*.

Can anyone suggest an alternate regex that Sublime Text 3 can handle?

Thanks!

0 Likes

#2

Well, firstly (?0) is nothing I have seen in any regex flavor I have worked with so far, and secondly I’m not sure what you intend to match exactly.

Either way, I assume you are talking about the “subexp call” feature, which Oniguruma provides in form of \g.

0 Likes