Reply to Re: [PHP] preg_match

Your name:

Reply:


Posted by Robin Vickery on 08/22/05 18:13

On 8/22/05, Richard Lynch <ceo@l-i-e.com> wrote:
> On Sat, August 20, 2005 5:00 am, John Nichel wrote:
> > Personally, I have never used \\ in PCRE when looking for things like
> > spaces (\s), word boundraries (\b), etc. and it's all worked out fine.
>
> Personally, {
> I
> } have
> never {
> used
> proper
> indenting
> in
> my
> code } and
> it's
> all
> worked
> out
> fine;
>
> :-)

Unnecessary backslashes make your regular expressions almost as
unreadable as those indents.

You only ever need to escape a backslash in single-quotes if it's
before another backslash or a single-quote.

In fact the manual itself explicitly says this:

http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

So what benefit exactly do you see in doubling up all the backslashes
in a single-quoted regexp? It's certainly not helping readability, and
they don't actually do anything...

-robin

[Back to original 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

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