jd2007 Posted September 30, 2007 Share Posted September 30, 2007 give me a hint of what to do to take everything between <html> and </html> below : <html> some html </html> what regex function to use ? Quote Link to comment https://forums.phpfreaks.com/topic/71240-hi-i-need-some-regex-help/ Share on other sites More sharing options...
LemonInflux Posted September 30, 2007 Share Posted September 30, 2007 what do you want to do, retrieve everything in between the html tags? ...Surely you could just file_Get_Contents and explode? <?php $file = file_get_contents('page.html'); $omg_boom = explode('<html>', $file); $onozbang = explode('</html>', $omg_boom[1]); //Then, $onozbang[0] is everything between the <html> tags. Quote Link to comment https://forums.phpfreaks.com/topic/71240-hi-i-need-some-regex-help/#findComment-358336 Share on other sites More sharing options...
infid3l Posted September 30, 2007 Share Posted September 30, 2007 Here's a function I wrote that you might find useful: <?php function GetBetween($find1, $find2, $string) { $parse = explode($find1, $string, 2); $parse = substr($parse[1], 0, stripos($parse[1], $find2)); return $parse; } print GetBetween("<b>", "</b>", "<b>DATA</b>"); // prints "DATA" ?> Quote Link to comment https://forums.phpfreaks.com/topic/71240-hi-i-need-some-regex-help/#findComment-358338 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.