Thanks!

But I still nned to escape, but only once. I mean '<\/pre>' instead of
'<\\/pre>'.

"Andrey Hristov" <[EMAIL PROTECTED]> wrote in message
004401c12f02$ae5a2d30$0b01a8c0@ANDreY">news:004401c12f02$ae5a2d30$0b01a8c0@ANDreY...
> I think that is the solution:
>
> <?
>   $mem = "<pre>hello world\nI love you all!</pre>";
>   $re = "/<pre>(.+?)<\\/pre>/is";
>
>   preg_match_all($re, $mem, $match);
>
>   var_dump($match);
> ?>
>
> The modifier which will work for you is 's', not 'm'. Look at the manual
at :
> http://www.php.net/manual/en/pcre.pattern.modifiers.php
>
> This produces:
> array(2) {
>   [0]=>
>   array(1) {
>     [0]=>
>     string(16) "<pre>hello world"
>   }
>   [1]=>
>   array(1) {
>     [0]=>
>     string(11) "hello world"
>   }
> }
>
> In this case it's better your pattern to be : "|<pre>(.+?)</pre>|is"
> / was changed to |, and there is no need to escape.
>
> Andrey Hristov
> IcyGEN Corporation
> http://www.icygen.com
> 99%
>
>
>
> ----- Original Message -----
> From: "_lallous" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, August 27, 2001 5:43 PM
> Subject: [PHP] PCRE Multiline modifier
>
>
> > <pre>
> > <?
> >   $mem = "<pre>hello world\nI love you all!</pre>";
> >   $re = "/<pre>(.+?)<\\/pre>/im";
> >
> >   preg_match_all($re, $mem, $match);
> >
> >   var_dump($match);
> > ?>
> > </pre>
> >
> > and the output is:
> > array(2) {
> >   [0]=>
> >   array(0) {
> >   }
> >   [1]=>
> >   array(0) {
> >   }
> > }
> >
> > if i remove the \n in the $mem var everything works okay.
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to