RE: [PHP] so nobody knows how do get rid of everything outside or certain tags?

From: Date: Thu, 15 Aug 2002 16:40:16 +0000
Subject: RE: [PHP] so nobody knows how do get rid of everything outside or certain tags?
Groups: php.general 
Request: Send a blank email to php-general+get-112812@lists.php.net to get a copy of this message
Try this, it should work great. $starttag='<DIV>' $endtag='</DIV>' $pos_starttag=strpos(strtoupper($origstring),$starttag); $pos_endtag=strrpos(strtoupper($origstring),$endtag)+strlen($endtag); if($pos_starttag===False OR $pos_endtag===False) return 0; $newstring = substr(origstring,$pos_starttag,$pos_endtag-$pos_startag-1); return $newsttring; -----Original Message----- From: Joseph W. Goff [mailto:jgoff@users.sourceforge.net] Sent: Thursday, August 15, 2002 9:54 AM To: victor@argilent.com; php-general@lists.php.net Subject: Re: [PHP] so nobody knows how do get rid of everything outside or certain tags? preg_match('!<div[^>]+>(.*)</div>!Uis',$info,$regs); $everything_between_divs=$regs[1]; ----- Original Message ----- From: "Jay Blanchard" <jay.blanchard@niicommunications.com> To: <victor@argilent.com>; <php-general@lists.php.net> Sent: Thursday, August 15, 2002 11:44 AM Subject: RE: [PHP] so nobody knows how do get rid of everything outside or certain tags? > [snip] > I asked this question a while ago, and I am still seeking clarification, > I fooled with ereg_replace and they only do a piece of what I want, I > would like to know how to keep only a chunk of text defined between 2 > tags let's say, <div> and </div> and ignore everything else, I also have > to search and replace certain tags between, but I know how to do that > with ereg_replace. So can anyone help me echo only what is between the > div tags? Please? > [/snip] > > Why not take the the beginning <div>, everything in the middle, and the end > </div> tag and explode() them into an array and then get what you want and > write it out? I didn't see your originl post and don't know if there was > more detail available, but I hope this helps. > > Jay > > I'm not tense.just terribly, terribly alert > > *********************************************************** > * Texas PHP Developers Conf Spring 2003 * > * T Bar M Resort & Conference Center * > * New Braunfels, Texas * > * San Antonio Area PHP Developers Group * > * Interested? Contact jay.blanchard@niicommunications.com * > *********************************************************** > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#112812) next »