You are here: Re: preg_split lookbehind assertion « PHP Programming Language « IT news, forums, messages
Re: preg_split lookbehind assertion

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация