You can do as Jim says here or go back and read the manual section again for eregi and ereg. What you're trying to do should be written more like this:
<?php $str = '<body bgcolor="#ffffff">'; $numMatches = eregi('(<body)(.*)(>)',$str,$results); print("numMatches: $numMatches <br>\n"); print("body contents: $results[2] <br>\n"); print("all results: "); print_r($results); ?> -Steve On Thursday, January 3, 2002, at 12:15 PM, Jim Lucas [php] wrote: > I have seen this question reposted for the past week. now why don't you > just work with the entire thing. > > get the "<body ... >" > > now once you have that, do this > > $str = preg_replace("<body", "", $str) > $str = preg_replace(">", "", $str) > > now your $str var will only have the properties. > > Jim > ----- Original Message ----- > From: "[-^-!-%-" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, January 02, 2002 12:45 PM > Subject: [PHP] Regular Expression > > >> >> 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?" >> -+___________________________________+- >> >> >> >> >> -- >> 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: php-list- >> [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] > -- 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]