RE: A quick ereg translation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.seb@xxxxxxxxx
> To: php-general@xxxxxxxxxxxxx
> Subject: Re:  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
> 
 		 	   		  

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux