Textmate Regex: Find word based on a pattern that only exists in declaration

谁说我不能喝 提交于 2020-01-07 00:57:50

问题


Is it possible to have a regex expression match with a pattern that finds a word and then also matches with any other occurrences of that word?

To be more explicit, lets say I have some language that declares variables with a # like #varName

I also have the regex expression (?<=#)\w* to locate such words.

However, in another part of my code I use varName without the # and thus cannot identify it using the same method.

So my question is, can I write one regex expression to locate varName in both instances?

My intention is to use this to write a syntax definition for sublime-text, so I am using textmate's regex syntax.

来源:https://stackoverflow.com/questions/38288803/textmate-regex-find-word-based-on-a-pattern-that-only-exists-in-declaration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!