fork(1) download
  1. <?
  2. $text=file_get_contents("php://stdin");
  3. $RE="/\\G(.*?(?<!\\\\)(?:\\\\\\\\)*):/";
  4. var_dump(preg_split($RE, $text, 0, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE));
  5. ?>
Success #stdin #stdout 0.01s 20520KB
stdin
a\\\\:b\\:c:d\:h:g
stdout
array(5) {
  [0]=>
  string(5) "a\\\\"
  [1]=>
  string(3) "b\\"
  [2]=>
  string(1) "c"
  [3]=>
  string(4) "d\:h"
  [4]=>
  string(1) "g"
}