You are here: Re: Windows/ Unix regular expression question « PHP Programming Language « IT news, forums, messages
Re: Windows/ Unix regular expression question

Posted by Michael Fesser on 05/30/07 10:42

..oO(e_matthes@hotmail.com)

>I would still really like to know, however, why my local php
>installation and the installation on my shared server interpret this
>line differently:
>$regExp = "/^[a-zA-Z0-9_\- ]\{$minLength,$maxLength}/";
>
>My understanding is that the backslash tells php to escape the
>following open brace. It seems to do that locally, but not on the
>shared server. Any reason why the behavior is different on the two
>systems?

Different PHP versions? From the manual:

| Again, if you try to escape any other character, the backslash will be
| printed too! Before PHP 5.1.1, backslash in \{$var} hasn't been
| printed.

and

| Since you can't escape '{', [...]

I would use sprintf() as suggested by Toby.

Micha

 

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

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