The Little Guy Posted February 8, 2011 Share Posted February 8, 2011 I would like to grab sections out of a body of text, but I am not sure how to get started with this... So, lets say I have an array of word to find in the doc $words = array_unique(array('the', 'squirrel', 'jumped', 'the', 'fence')); Using that array, I would like to get key section in the body of text (that was passed to the function) and get about 25 characters before the text and about 25 after. I want a maximum of three sections, and have them concatenated by some dots. basically it is the same look as google: Once located, block off all but one using flashing, wire fence or hardware cloth. .... If the squirrel is jumping from high to low, as from a tree Any Ideas how I could do something like this? Quote Link to comment https://forums.phpfreaks.com/topic/227094-get-sections-of-text-from-a-body-of-text/ Share on other sites More sharing options...
fortnox007 Posted February 8, 2011 Share Posted February 8, 2011 I am not sure if you mean this but pregmatch could do the job. edit: oh no i am incorrect you want additional stuff sorry Quote Link to comment https://forums.phpfreaks.com/topic/227094-get-sections-of-text-from-a-body-of-text/#findComment-1171583 Share on other sites More sharing options...
litebearer Posted February 8, 2011 Share Posted February 8, 2011 Similar question - http://www.phpfreaks.com/forums/php-coding-help/search-a-word-with-query-select/msg1505684/#msg1505684 A bit of modifying should get you what you want/need Quote Link to comment https://forums.phpfreaks.com/topic/227094-get-sections-of-text-from-a-body-of-text/#findComment-1171603 Share on other sites More sharing options...
The Little Guy Posted February 11, 2011 Author Share Posted February 11, 2011 Thanks! I took that and modified it! Quote Link to comment https://forums.phpfreaks.com/topic/227094-get-sections-of-text-from-a-body-of-text/#findComment-1172774 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.