fork download
  1. <?php
  2. $str = ":1-2-35:2-3-1:5-6-27456:35-2-11:9-5-6:1-5-2:";
  3. $pattern = "/:(2-\d+-\d+|\d+-2-\d+|\d+-\d+-2)(?=:)/";
  4.  
  5. preg_match_all($pattern, $str, $matches);
  6.  
  7. print_r($matches[1]);
  8.  
  9. ?>
  10.  
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 1-2-35
    [1] => 2-3-1
    [2] => 35-2-11
    [3] => 1-5-2
)