bapi Posted November 20, 2007 Share Posted November 20, 2007 hi, I want to create a script which could extract a paragraph (which are under <p> .......</p>) from text file. How can it be done Quote Link to comment https://forums.phpfreaks.com/topic/78067-extracting-pragraph-from-file/ Share on other sites More sharing options...
MadTechie Posted November 20, 2007 Share Posted November 20, 2007 something like this <?php $fulltext = "blar <p>Hello world</p> blar"; $text = ""; if (preg_match('%<p>(.*?)</p>%si', $fulltext , $regs)) { $text= $regs[1]; } echo $text; ?> Quote Link to comment https://forums.phpfreaks.com/topic/78067-extracting-pragraph-from-file/#findComment-395148 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.