Re: HTML Parse Issue
| From: | Tom Ray [Lists] | Date: | Sun, 14 Oct 2007 18:03:07 +0000 |
| Subject: | Re: HTML Parse Issue | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263204@lists.php.net to get a copy of this message | ||
admin@buskirkgraphics.com wrote:
I am having a issue parsing an html file. I want to pull all the data between two html tags. Problem I am having is that no matter what I try I can pull either tag or both but not the data in between. <div class="record" id="one"><div class="rideon"><h2><span>Welcome toRideon</span></h2></div></div> </div class="record" id="one"> function datamatch($document) {preg_match_all('/<div class="record" [^<>]*>(.*)/<\/divclass="record" [^<>]*>/i',$document,$elements); $match = implode("\r\n",$elements[0]); return $match; } This should return the following <div class="record" id="one"><div class="rideon"><h2><span>Welcome toRideon</span></h2></div></div> </div class="record" id="one"> You may want to try escaping your quotations. That could cause some issues.