Re: Regular Expression
| From: | Joe Webster | Date: | Wed, 02 Jan 2002 17:53:39 +0000 |
| Subject: | Re: Regular Expression | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79235@lists.php.net to get a copy of this message | ||
preg_match("/<body\s([^>]*)/i", $html, $args);
$body_props = $args[1];
preg is much faster/better than ereg.
note the /i at the end of the preg, that makes it case insative, drop the i
if you want it to be case sensative on the match.
-Joe
"John Monfort" <monfort@engineering.sdsu.edu> wrote in message
news:Pine.GSO.4.31.0112300441510.26701-100000@kahuna.engineering.sdsu.edu...
>
> Hello everyone!
>
> I'm trying to get the text inside the <BODY> tag, using regular
> expression.
>
> $area = eregi('(<body)(.*)<">)',$str);
>
> Where $str is the string containing
> <body bgcolor="#999999" tex="#..." ...>
>
> When I print $area, the string contains the entire content of $str. I
> get something like:
>
> <body ...>
> <p>
> .
> .
> .
> </body>
> </html>
>
>
>
> __________John Monfort_________________
> _+-----------------------------------+_
> P E P I E D E S I G N S
> www.pepiedesigns.com
> "The world is waiting, are you ready?"
> -+___________________________________+-
>
>