title: How to extract Key-Value pairs from a string, when the Key itself is the separator?
body: <p>Say there is a string in the loose "format",</p>
  
  <pre><code>string str = "V1,B=V1,C=V1,V2,V3,D=V1,V2,A=V1,=V2,V3";
  </code></pre>
  
  <p>and a known set of Keys</p>
  
  <pre><code>List&lt;string&gt; lst = new List&lt;string&gt;() { "A", "B", "C", "D" };
  </code></pre>
  
  <p>How can the Key-Value pairs shown below be extracted? (Any text before the first Key should be treated as the Value for the null Key. Also the Values shown below have any trailing comma removed.)</p>
  
  <pre class="lang-none prettyprint-override"><code>Key     Value
  (null)  V1
  A       V1,=V2,V3     (The = here is, unfortunately, part of the value)
  B       V1
  C       V1,V2,V3 
  D       V1,V2
  </code></pre>
  
  <p>This problem is difficult because it is <em>not</em> possible to split immediately on either the <code>=</code> or <code>,</code>.</p>