preg_split lookbehind assertion

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I want to split a string where | delimits a line.  I want to use a look  
behind assertion

$txt = 'hello\|there|how|is|it|going';
$re = '/(?<!\)\|/';
print_r ( preg_split($re, $txt));

I mean to say with the $re: match '|' that is not preceded by a ''

however, when run, I get  

 preg_split(): Compilation failed: missing ) at offset 8

what am I doing wrong? thanks.

Re: preg_split lookbehind assertion

Quoted text here. Click to load it

I figured it out:

$re = '/(?<!\x5c)\|/';

Site Timeline