fork(1) download
  1. <?php
  2.  
  3. $rx = "~(?<!\\\\)(?:\\\\{2})*\(\?(?|P?<([_A-Za-z]\w{0,31})>|'([_A-Za-z]\w{0,31})')~";
  4. $s = "(?P<name>\w+): (?<name2>\w+): (?'digit'\d+)";
  5. preg_match_all($rx, $s, $res);
  6. print_r($res[1]);
Success #stdin #stdout 0.02s 23784KB
stdin
Standard input is empty
stdout
Array
(
    [0] => name
    [1] => name2
    [2] => digit
)