I already asked the question how to get the string fields from a pipe-separated string with pipe-escaping, and got an answer that worked well on http://www.regex101.com: a regex to get the single words of a pipe-separated string, supporting pipe-escaping.
Unfortunately this does not seem to work in PHP's preg_match_all() function:
$input = 'word1| word 2 |word\|3';
$pattern = '/(?P<w>(?:[^\\|]+|\\\|?)+)/';
$matches = array();
preg_match_all($pattern,$input,$matches);
// Expected $matches: $matches['w'] => array('word1', ' word 2 ', 'word\|3')
What am I missing? The example is working fine here: