You're correct in the fact that you've added delimiters to the pattern, however 
you also need to specify the "s" pattern modifier so that the search spans over 
multiple lines.


This should do the trick:

preg_match('#<body>(.*)</body>#is', $content, $matches);


---

> Date: Sat, 25 Aug 2012 23:10:08 +0200
> From: krebs....@gmail.com
> To: php-general@lists.php.net
> Subject: Re: [PHP] A quick ereg translation
> 
> Am 25.08.2012 23:06, schrieb Lester Caine:
> > ereg('<body>(.*)</body>', $phpinfo, $regs);
> >
> > Pulls the body of phpinfo() to use with a tidy header of other system
> > information, but I'm struggling to get a pcre alternative. Anybody
> > already cracked this one?
> >
> 
> usually it's just fine to wrap the pattern into delimiter.
> 
> | preg_match('~<body>(.*)</body>~i', $phpinfo, $regs);
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
                                          

Reply via email to