I'm working on a grammar extension in VS Code, and I'm having difficulty with a look behind regex pattern. Given the following string, I want to only return cmp when it's preceded by the @fmt(
@fmt(cmp,foo)
The matching string I used in another editor was this:
(?<=[@|©](fmt)\()(\w+)
However, this is not working in VS Code, when I do a regex search it comes back with the error that it's not a valid expression. Playing around with it, the problem is the <= characters, which indicate the look behind.
Doing a search of the VS Code website doesn't return any kind of regex reference guide. Searching Stack Overflow came up with this question, which states that Visual Studio has a unique regex definitions. Unfortunately, the example given in that question doesn't work in VS Code.
Does anyone know how to do a look behind regex in VS Code? Or at least know where the regex documentation for VS Code is located?
I worry that it's not possible, since according to Stack Overflow reference look behinds aren't supported in JavaScript. There is another question that shows how to mimic look behinds in a JavaScript function, but I don't know if it's possible to extend a language in VS Code with user-defined functions. If anyone knows how to do that, and can point me in that direction, that would also be an acceptable workaround.