homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

PHP Regular Expression Question
Need help with PHP Regular Expressions

 9:03 pm on Apr 20, 2006 (gmt 0)

I've only used regular expressions a couple of times before and never in PHP so need a little help.
I am reading in an external html document (which regular changes) into a variable. I then need to extract a section of it which starts:

<table class="data">

and finishes:


I'm thinking regular expressions are the way to pull out just this section on the fly. I have looked at prog_match_all but not sure on the pattern to use.




 10:01 pm on Apr 20, 2006 (gmt 0)

A regular expression would work, but you could also do it with explodes like this:

$text = "(The html code here)";

$temp = explode('<table class="data">',$text,2);
$temp2 = explode('</table>',$temp[1],2);

$extracted_html = $temp2[0];

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved