You are here: Re: question about preg_*'s s modifer « PHP Programming Language « IT news, forums, messages
Re: question about preg_*'s s modifer

Posted by Rik on 02/05/07 22:03

yawnmoth <terra1024@yahoo.com> wrote:

> On Feb 5, 2:13 pm, Rik <luiheidsgoe...@hotmail.com> wrote:
>> yawnmoth<terra1...@yahoo.com> wrote:
>> > Say I have the following script:
>>
>> > <?php
>> > $contents =3D file_get_contents('preg_test.txt');
>> > echo preg_match("#(.*?)[\r\n]+ddddddddddddd#s",$contents) ? 'is
>> > equal' : 'is not equal';
>> > ?>
>>
>> > Here's preg_test.txt:
>>
>> >http://www.geocities.com/terra1024/preg_test.txt
>>
>> > (it's a malformed part of a postscript file, in case you're curious=
)
>>
>> > My question is... when I remove the s modifier, preg_match returns=

>> > true. When the s modifier is there, it returns false. I'm not rea=
lly
>> > sure why this is. The s modifier means that . includes new lines a=
nd
>> > carriage returns. In either case, it seems like it should match.
>>
>> Hmmmz, they both match here in PHP 5.1.4, PCRE Library Version 6.6
>> 06-Feb-2006, with or without the modifier. What version are you using=
?
>
> PHP 5.2.0 (cli).

Hmmmz, the file you gave was the actual file you tested it with, or just=
a =

part of it? Might be it just maxes out. I really don't have any other =

ideas :(
-- =

Rik Wasmus

 

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

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