Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REGEX] Non fixed-length lookbehind support #76502

Closed
jerryc05 opened this issue Jul 3, 2019 · 4 comments
Closed

[REGEX] Non fixed-length lookbehind support #76502

jerryc05 opened this issue Jul 3, 2019 · 4 comments
Assignees

Comments

@jerryc05
Copy link

jerryc05 commented Jul 3, 2019

I am writing a extension for language syntax highlighting, and I would like to use non fixed-length lookbehind regex like (?<=void[ \t]+)\w+ to highlight function name, but it does not work. However, fixed-length lookbehind works. Is there any way to fix this, or any workarounds? Thx.

@bpasero bpasero transferred this issue from microsoft/vscode-extension-vscode Jul 3, 2019
@vscodebot
Copy link

vscodebot bot commented Jul 3, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@dbaeumer
Copy link
Member

dbaeumer commented Jul 3, 2019

@aeschli @alexandrudima since this is TextMate, any idea.

@jerryc05
Copy link
Author

jerryc05 commented Jul 3, 2019

Okay one possible solution is to move [ \t]+ out of the lookbehind block, and that worked fine.

But what if there are more modifiers like public void funcNameToCatch()?

@aeschli
Copy link
Contributor

aeschli commented Jul 4, 2019

TextMate Grammars use Oniguruma as RegExp engine. The spec there says:

Subexp of look-behind must be fixed character length.
                     But different character length is allowed in top level
                     alternatives only.
                     ex. (?<=a|bc) is OK. (?<=aaa(?:b|cd)) is not allowed.

@aeschli aeschli closed this as completed Jul 4, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants