There's this really cool new set of features in resharper 9. Particularly regarding Regex and the syntax highlighting. This post gives a good overview of how it works.
Basically, by putting your cursor on any string, and choosing this context command:
Will result in this highlighting:
I want to know where resharper stores the reference to that string, and how it will then know it is a regular expression.
I can't find it in resharper settings anywhere (besides turning the feature on and off). Any idea where it could exist?
It seems that this information is stored in the solution cache, because after deleting the cache, the manually triggered highlighting of regex strings disappear.
Anyways, by using typed regexes, R# automatically highlights them:
If you really have to use strings, you could alternatively use the following trick utilizing the
RegexPattern
code annotation attribute.