As of ST 3120, are look-behind RegExs supported at all?
I know that the issue of using look-behind RegExs in syntax definitions has already been asked many times over in the forum! But because I’ve seen varying answers (ranging from “it’s a bug that’s going to be fixed” to “they are partly supported”), and because there’s confusion regarding the various versions of ST, which seems to have adopted different RegEx engines in the course of time, including switching engine within ST3, I need to ask this question and dispel all confusion.
The official Syntaxes Documentation states:
The match key is a regex, supporting features from the Oniguruma regex engine.
So it comes natural to expect that look-behind are supported.
But, in practice, when I run “Syntax Tests - Regex compatibility” on the syntax I’m working on, I get a lot of:
Packages/.../MySyntax.sublime-syntax:874:9: Negative look behind is not supported
Packages/.../MySyntax.sublime-syntax:948:9: Look behind is not supported
Packages/.../MySyntax.sublime-syntax:966:9: Look behind is not supported
FAILED: 12 patterns in "Packages/.../MySyntax.sublime-syntax" are incompatible with the new regex engine
[Finished]
Which confuses me.
Since look-behind RegExs are something that anyone working on a syntax will undoubtedly try to use, I think that it’s worth mentioning in the Syntaxes Documentation whether they are supported or not — instead of just linking to the Oniguruma documentation, which describes them as being supported!
Until the official documentation will mention explicitly the current state of ST3 RegEx engine, and which features it support and which it doesn’t, there’ll always be confusion on the matter — which can be frustrating for those willing to create new syntaxes, and it will ultimately lead to the same questions being asked again on the forum.