title: How to extract key value pairs from null terminated strings with regex?
body: <p>I've got some key value pair data which I get back from a request from a server which looks like this. </p>
  
  <pre><code>Key0Value0Key20Value20Key30Value30
  </code></pre>
  
  <p>I've substituted the null character with a '0'. I'm not sure how to go about this using regular expressions. </p>
  
  <p>I'd like to have the values like this</p>
  
  <pre><code>[Key]  =&gt; Value
  [Key2] =&gt; Value2
  [Key3] =&gt; Value3
  </code></pre>
  
  <p>This is the closest I could get</p>
  
  <pre><code>0(.+?)0(.+?)0(?=0|$)
  </code></pre>
  
  <p>Which only works if every key pair value has a "0" before and after it. As it does a look ahead to see if it can find a second "0"  or the end of the string. </p>
  
  <p>So the problem I've got is that the key pair values are separated by the same delimiter so you can't tell them apart... without the knowledge that the data will always start with a key and end with a value. An alternating pattern. </p>
  
  <p>So... in a nutshell is there anyway to separate key value pairs in regex when they have the same delimiter?</p>