Posted by darius on 03/25/07 06:42
darius <noone@here.invalid> wrote in
news:67443629862.8554256396.39165@news.newsguy.com...
> hi
>
> 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.
>
I figured it out:
$re = '/(?<!\x5c)\|/';
Navigation:
[Reply to this message]
|