fork download
  1. <?php
  2.  
  3. // your code goes here
  4. $data = '[key01][key02][key04:DA:CQ#1:CQ#3][key07:BA:ET:CQ#5]';
  5. preg_match_all("(\[([^]]+)\])", $data, $matcher);
  6. print_r($matcher[1]);
Success #stdin #stdout 0.02s 24040KB
stdin
Standard input is empty
stdout
Array
(
    [0] => key01
    [1] => key02
    [2] => key04:DA:CQ#1:CQ#3
    [3] => key07:BA:ET:CQ#5
)