<?php $str = '1|2\\|2|3\\\\|4\\\\\\|4';echo $str . PHP_EOL;$r = preg_split('~\\\\.(*SKIP)(*FAIL)|\\|~s', $str);var_dump($r);
Standard input is empty
1|2\|2|3\\|4\\\|4 array(4) { [0]=> string(1) "1" [1]=> string(4) "2\|2" [2]=> string(3) "3\\" [3]=> string(6) "4\\\|4" }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!