fork(1) download
  1. <?php
  2.  
  3. $re = '/(?:\G(?!^)\s*|Stream mapping:\s*)\K([a-zA-Z]+\s+#[0-9]+:[0-9]+).*/';
  4. $str = 'Metadata:
  5. variant_bitrate : 800000
  6. Stream mapping:
  7. Stream #0:4 -> #0:0 (copy)
  8. Stream #0:5 -> #0:1 (copy)
  9. Press [q] to stop, [?] for help';
  10.  
  11. if (preg_match_all($re, $str, $m)) {
  12. print_r($m[1]);
  13. }
Success #stdin #stdout 0.03s 23908KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Stream #0:4
    [1] => Stream #0:5
)