title: php preg split data
body: <p>I want to split text by sections and the names of the sections that are inside of === === So data is like</p>
  
  <pre><code>   ===A=== 
     a
     ===B=== 
     b
     ===C=== 
     c
  </code></pre>
  
  <p>preg split is like:</p>
  
  <pre><code>  $sections = preg_split('/===([^=]+)===(?!=)/', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
  </code></pre>
  
  <p>but if the data are like</p>
  
  <pre><code>   ===A=== 
     a
     ====0==== 
     0
     ===B=== 
     b
     ===C=== 
     c
  </code></pre>
  
  <p>It gets wrong (i need to split it only by sections with 3x === and ignore the other parts) that's why there is the negative look behind.</p>
  
  <p><strong>Edit</strong>: it turned out that problem was that split took last === from the ====0==== and made new fake section name until first === of ===B=== so it made from</p>
  
  <pre><code> ====0==== 
     0
   ===B=== 
  </code></pre>
  
  <p>new fake section like this (cutting away what is in parenthesis)</p>
  
  <pre><code> (====0=)===
   0
   ===(B===)
  </code></pre>