title: Regex for matching C# string literals
body: <p>I am trying to write a <a href="http://en.wikipedia.org/wiki/Regular_expression" rel="nofollow">regular expression</a> that will match a string that contains name-value pairs of the form:</p>
  
  <pre><code>&lt;name&gt; = &lt;value&gt;, &lt;name&gt; = &lt;value&gt;, ...
  </code></pre>
  
  <p>Where &lt;value> is a C# string literal. I already know the s that I need to find via this regular expression. So far I have the following:</p>
  
  <pre><code>regex = new Regex(fieldName + @"\s*=\s*""(.*?)""");
  </code></pre>
  
  <p>This works well, but it of course fails to match in the case where the string I am trying to match contans a &lt;value> with an escaped quote. I am struggling to work out how to solve this, I <em>think</em> I need a lookahead, but need a few pointers. As an example, I would like to be able to match the value of the 'difficult' named value below:</p>
  
  <pre><code>difficult = "\\\a\b\'\"\0\f \t\v", easy = "one"
  </code></pre>
  
  <p>I would appreciate a decent explanation with your answers, I want to learn, rather than copy ;-)</p>