fork download
  1. <?php
  2.  
  3. $str = '/part-of-{INTERESETINGSTUFF}/an-url/{MORESTUFF}';
  4. $res = array_filter(preg_split('/({[^{}]*})/', $str, -1, PREG_SPLIT_DELIM_CAPTURE));
  5. print_r($res);
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
Array
(
    [0] => /part-of-
    [1] => {INTERESETINGSTUFF}
    [2] => /an-url/
    [3] => {MORESTUFF}
)