title: Parse PHP array stored as string and concatenate items to string in Power Query
body: <p>I'm doing my first steps with Power Query in Excel. I have exported some data from PHP to a .csv file and want to import them to an excel sheet. This works great with strings and numbers, but I need an improved Power Query statement to read array data.</p>
  <p>The PHP string array looks something like:</p>
  <pre><code>a:3:{i:0;s:4:&quot;Text&quot;;i:1;s:2:&quot;in&quot;;i:2;s:5:&quot;array&quot;;}
  </code></pre>
  <ul>
  <li><code>&quot;a&quot;</code> stands for the array name</li>
  <li><code>&quot;3&quot;</code> is the number of items in array</li>
  <li>Within the curly brace <code>{}</code> stands the array with</li>
  <li><code>&quot;i&quot;</code> for the index and</li>
  <li><code>&quot;s&quot;</code> for the length of the item (string)</li>
  <li>The strings <code>&quot;Text&quot;</code>, <code>&quot;in&quot;</code> and <code>&quot;array&quot;</code> are the items in the array, which I want to parse.</li>
  </ul>
  <p>My Idea is to parse the PHP array string to a Power Query list and concatenate the items to a comma separated string.</p>
  <p>In the end i want to have this string:</p>
  <pre><code>&quot;Text, in, array&quot;
  </code></pre>
  <p>I have tried to remove the <code>a</code>, <code>i</code>, <code>s</code>, <code>;</code> and the numbers to get something like a json string:</p>
  <pre><code>= Text.Remove([PHP-array],{&quot;0&quot;..&quot;9&quot;}),...
  </code></pre>
  <p>And then parse with:</p>
  <pre><code>Json.Document([JSON-string])
  </code></pre>
  <p>But this seems inelegant and prone to error.</p>
  <p>Is there a way to parse the PHP array to a list and than serialize it to a comma separated string?</p>
  <p><strong>Edit/Update</strong></p>
  <p>A new idea is to extract only the strings between quotes <code>&quot;</code> and merge them. It tried it this way:</p>
  <pre><code>Table.TransformColumns(#&quot;Column&quot;, {{&quot;function&quot;, each Text.BetweenDelimiters(_, &quot;&quot;&quot;&quot;, &quot;&quot;&quot;&quot;), type text}})
  </code></pre>
  <p>But this works only for the first occurence. I would need to repeat it for each item and separate them with comma. But how to do this? Is there a kind of a loop in Power Query?</p>