title: asp.net mvc 3 regular expression returning encoded html?
body: <pre><code>public static string MakeAnchor(string text) 
  {
      string pattern = @"((?&lt;Protocol&gt;\w+):\/\/(?&lt;Domain&gt;[\w@][\w.:@]+)\/?[\w\.?=%&amp;=\-@/$,]*)";
      Regex r = new Regex(pattern, RegexOptions.Multiline);
      var anchor = r.Replace(text, "&lt;a href=\"$1\" target=\"_blank\"&gt;$1&lt;/a&gt;");
      return anchor;
  }
  </code></pre>
  
  <p>This method returns <code>&amp;lt;a href=&amp;quot;http://google.com/&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;http://google.com/&amp;lt;/a&amp;gt;</code> if I pass it some text containing <a href="http://google.com/" rel="nofollow">http://google.com/</a></p>
  
  <p>instead of <code>&amp;lt;a href=&amp;quot;http://google.com/&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;http://google.com/&amp;lt;/a&amp;gt;</code></p>
  
  <p>I'm using razor views with MVC 3. I'm stumped. Is there some sort of new view encoding in MVC 3 that I'm unaware of?</p>