fork(1) download
  1. <?php
  2.  
  3. $str = 'A single match example [date|Y-m-d|today] here.';
  4. if (preg_match('/\[([^][]+)]/', $str, $matches)) {
  5. print_r(explode("|", $matches[1]));
  6. }
  7.  
  8.  
Success #stdin #stdout 0.02s 24088KB
stdin
Standard input is empty
stdout
Array
(
    [0] => date
    [1] => Y-m-d
    [2] => today
)