title: Exclude data from brackets using regex (preg_match_all)
body: <p>Input string:</p>
  
  <pre><code>:txt{sometext}:alpha
  </code></pre>
  
  <p>I want to extract data like this (extracted from brackets):</p>
  
  <p>Result using <code>preg_match_all()</code>:</p>
  
  <pre><code>sometext
  </code></pre>
  
  <p>Trying like this, but none of this works:</p>
  
  <pre><code>php &gt;  preg_match_all('/^(\:txt)(.*)+(\{)(.*)+(\})/i', ':txt{sometext}:alpha', $m); var_dump($m);
  array(6) {
    [0] =&gt;
    array(1) {
      [0] =&gt;
      string(14) ":txt{sometext}"
    }
    [1] =&gt;
    array(1) {
      [0] =&gt;
      string(1) ":"
    }
    [2] =&gt;
    array(1) {
      [0] =&gt;
      string(0) ""
    }
    [3] =&gt;
    array(1) {
      [0] =&gt;
      string(1) "{"
    }
    [4] =&gt;
    array(1) {
      [0] =&gt;
      string(0) ""
    }
    [5] =&gt;
    array(1) {
      [0] =&gt;
      string(1) "}"
    }
  }
  </code></pre>
  
  <p>Note: as sample I have like this <code>:txt{sometext}:alpha:another{mydata}</code>, so I can extract data from <code>:another</code> and give results like <code>mydata</code>.</p>
  
  <p>RESULTS:</p>
  
  <p>Result from Sniffer:</p>
  
  <pre><code>php &gt;  preg_match_all('/(?&lt;=:txt{)([^}]+)(?=})/', ':txt{sometext}:alpha', $x); var_dump($x);
  array(2) {
    [0] =&gt;
    array(1) {
      [0] =&gt;
      string(8) "sometext"
    }
    [1] =&gt;
    array(1) {
      [0] =&gt;
      string(8) "sometext"
    }
  }
  </code></pre>
  
  <p>Result from Jerry:</p>
  
  <pre><code>php &gt;  preg_match_all('/^:txt\{([^}]+)\}/', ':txt{sometext}:alpha', $x); var_dump($x);
  array(2) {
    [0] =&gt;
    array(1) {
      [0] =&gt;
      string(14) ":txt{sometext}"
    }
    [1] =&gt;
    array(1) {
      [0] =&gt;
      string(8) "sometext"
    }
  }
  </code></pre>