title: preg_split a string by spaces not between single quotes
body: <p>I am trying to pref_split a string by spaces not between single quotes.</p>
  
  <p>This is the string I am working with:</p>
  
  <pre><code>'physical memory %'=92%;99;100 'physical memory'=29.69GB;31.68;32;0;32
  </code></pre>
  
  <p>The following regex pattern successfully matches the space that I want to split by:</p>
  
  <pre><code>/\x20(?=[^']*('[^']*'[^']*)*$)\g
  </code></pre>
  
  <p>The problem I am having is that I wrote this string using <a href="http://www.regexr.com/" rel="nofollow">http://www.regexr.com/</a> which is specific to JavaScript regex and I need this to work in PHP.</p>
  
  <p>This is the PHP code I have so far but it is throwing an error:</p>
  
  <pre><code>preg_split("/\x20(?=[^']*('[^']*'[^']*)*$)/g", "'physical memory %'=92%;99;100 'physical memory'=29.69GB;31.68;32;0;32");
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>preg_split(): Unknown modifier 'g'
  </code></pre>
  
  <p>If I remove the / and /g I get the following error:</p>
  
  <pre><code>preg_match_all(): Compilation failed: nothing to repeat at offset 0
  </code></pre>
  
  <p>My guess is that for some reason the regex in PHP isn't matching any values so it is unable to split the string. Can someone help with how to properly do this?</p>
  
  <p>Thank you.</p>