title: preg_match_all 'OR' operator
body: <p>I cannot get 'today' value from the string. The pattern is to get strings placed inside double curly braces and  strings placed outside double curly braces.</p>
  
  <p>I am getting only 'inside' values. The pattern is:</p>
  
  <pre><code>/({{(?P&lt;inside&gt;[^}{]+)}}|}}(?P&lt;outside&gt;[^}{]+){{)/
  </code></pre>
  
  <p>The string is</p>
  
  <pre><code>{{Friday}}today{{Sunday}}
  </code></pre>
  
  <p>The php code is:</p>
  
  <pre><code>$returnValue = preg_match_all('/({{(?P&lt;inside&gt;[^}{]+)}}|}}(?P&lt;outside&gt;[^}{]+){{)/', '{{Friday}}today{{Sunday}}', $matches);
  </code></pre>
  
  <p>This returns only that:</p>
  
  <pre><code>    array (
    0 =&gt; 
    array (
      0 =&gt; '{{Friday}}',
      1 =&gt; '{{Sunday}}',
    ),
    1 =&gt; 
    array (
      0 =&gt; '{{Friday}}',
      1 =&gt; '{{Sunday}}',
    ),
    'inside' =&gt; 
    array (
      0 =&gt; 'Friday',
      1 =&gt; 'Sunday',
    ),
    2 =&gt; 
    array (
      0 =&gt; 'Friday',
      1 =&gt; 'Sunday',
    ),
    'outside' =&gt; 
    array (
      0 =&gt; '',
      1 =&gt; '',
    ),
    3 =&gt; 
    array (
      0 =&gt; '',
      1 =&gt; '',
    ),
  )
  </code></pre>
  
  <p>There is nothing about 'today' in the array above.</p>
  
  <p>What is interesting when the parts of the pattern was replaced each other there were no 'Sunday' nor 'Suterday' values in the result but 'today'.</p>
  
  <p>It looks like consider only the first part of pattern.</p>
  
  <p>What pattern to get all values?
  Thank you.</p>
  
  <p><strong><em>Edited:</em></strong></p>
  
  <p><strong>1.</strong>
  Thanks the really great answers. But I must extend the problem a little. I testet your all propositions and they work good for the string</p>
  
  <pre><code>    {{Friday}}today{{Sunday}}
  </code></pre>
  
  <p>But they do not work for such a strings:</p>
  
  <pre><code>    {{Friday}}t{od{a}y{{Sunday}}
  </code></pre>
  
  <p>It should be such a value in the result</p>
  
  <pre><code>t{od{a}y
  </code></pre>
  
  <p>Cause only the double curly braces should be delimeters.</p>
  
  <p>I tried to adapt your great patterns to that requirements but not succeed. The substring '}}' and '{{' should be negated. Not only single '{' or '}'.</p>
  
  <p>How to get it?</p>
  
  <p><strong>2.</strong>
  Another problem but not so important is that the 'inner' and 'outer' result arrays should not have empty strings. See on the picture what i mean:
  <a href="http://i.stack.imgur.com/KqFPe.png" rel="nofollow">enter image description here</a></p>