fork download
  1. <?php
  2.  
  3. $re = "/(?|\\['([^][]*)']|'([^'\\\\]*(?:\\\\.[^'\\\\]*)*)')/";
  4. $str = "\$_['text_1'] = 'text_2 %d to %d of %d (%d text)';";
  5. preg_match_all($re, $str, $matches);
  6. print_r($matches[1]);
Success #stdin #stdout 0.03s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [0] => text_1
    [1] => text_2 %d to %d of %d (%d text)
)