fork download
  1. <?php
  2.  
  3. $re = "/:([^|]+)(?:\\||$)/";
  4. $str = "CPM-200:0123456L|CPM-100:9876543L|CJ Pro:CJP33-011";
  5.  
  6. preg_match_all($re, $str, $matches);
  7. print_r($matches[1]);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 0123456L
    [1] => 9876543L
    [2] => CJP33-011
)