title: How does Visual Studio syntax-highlight strings in the Regex constructor?
body: <p>Hi fellow programmers and nerds!</p>
  <p>When creating regular expressions Visual Studio, the IDE will highlight the string if it's preceded by a verbatim identifier (for example, <code>@&quot;Some string</code>). This looks something like this:</p>
  <p><a href="https://i.stack.imgur.com/dzCKs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dzCKs.png" alt="A screenshot of the highlighting" /></a></p>
  <p>(Notice the way the string is highlighted). Most of you will have seen this by now, I'm sure.</p>
  <p>My problem: I am using a package acquired from NuGet which deals with regular expressions, and they have a function which takes in a regular expression string, however their function doesn't have the syntax highlighting.</p>
  <p><a href="https://i.stack.imgur.com/SR8fc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SR8fc.png" alt="the function without highlighting" /></a></p>
  <p>As you can see, this just makes reading the Regex string just a pain. I mean, it's not all-too-important, but it would make a difference if we can just have that visually-helpful highlighting to reduce the time and effort one's brain uses trying to decipher the expression, especially in a case like mine where there will be quite a quantity of these expressions.</p>
  <p><strong>The question</strong></p>
  <p>So what I'm wanting to know is, is there a way to make a function highlight the string this way*, or is it just something that's hardwired into the IDE for the specific case of the Regex c-tor? Is there some sort of annotation which can be tacked onto the function to achieve this with minimal effort, or would it be necessary to use some sort of extension?</p>
  <p>*I have wrapped the call to <code>AddStyle()</code> into one of my own functions anyway, and the string will be passed as a parameter, so if any modifications need to be made to achieve the syntax-highlight, they can be made to my function. Therefore the fact that the <code>AddStyle()</code> function is from an external library should be irrelevant.</p>
  <p>If it's a lot of work then it's not worth my time, somebody else is welcome to develop an extension to solve this, but if there is a way...</p>
  <p><strong>Important distinction</strong></p>
  <p>Please bear in mind I am talking about Visual Studio, <em>NOT</em> Visual Studio Code.</p>
  <p>Also, if there is a way to pull the original expression string from the Regex, I might do it that way, since performance isn't a huge concern here as this is a once-on-startup thing, however I would <em>prefer</em> not to do it that way. I don't actually need the Regex object.</p>