fork(1) download
  1. <?php
  2.  
  3. $text = "123|@rand(тест {@rand(номер 1234|номер 4321)}|строка||";
  4. print_r(preg_split('~{@\w+\(.*?\)}(?![^|])(*SKIP)(*F)|\|~u', $text));
  5.  
Success #stdin #stdout 0.02s 25776KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 123
    [1] => @rand(тест {@rand(номер 1234|номер 4321)}
    [2] => строка
    [3] => 
    [4] => 
)