问题
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