title: PHP preg_split keeping delimiter in a different element
body: <p>I'm trying to split a string into an array of parts.</p>
  
  <p>String Example...</p>
  
  <pre><code>The quick brown fox [[random text here]] and then [[a different text here]]
  </code></pre>
  
  <p>Text between the square brackets will change and cannot be determined ahead of time. The preg_split I have so far will split, but it places the delimiters in other elements in the produced array, not the element I want it to be in.</p>
  
  <pre><code>$page_widget_split = preg_split('@(?&lt;=\[\[)(.*?)(?=\]\])@', $page_content,-1, PREG_SPLIT_DELIM_CAPTURE);
  </code></pre>
  
  <p>This produces something like this...</p>
  
  <pre><code>[0] =&gt; "The quick brown fox [[",
  [1] =&gt; "random text here]]",
  [2] =&gt; " and then [[",
  [3] =&gt; "a different text here]]"
  </code></pre>
  
  <p>The desired result would look like this...</p>
  
  <pre><code>[0] =&gt; "The quick brown fox",
  [1] =&gt; "[[random text here]]",
  [2] =&gt; " and then ",
  [3] =&gt; "[[a different text here]]"
  </code></pre>
  
  <p>As I'm far from understanding Regex, could someone please take a look and tell me what I'm missing in the regex ?</p>