Forum Moderators: coopster & phranque

Message Too Old, No Replies

Need a perl algorithm to

match search words and return an excerpt

         

newbies

7:24 am on Feb 20, 2004 (gmt 0)

10+ Year Member



I want to search a html page for one or more words and return an excerpt as search results, as Google does. That is to extract about 20 words (or 100 characters) up- and down-stream the matched words which is bolded.

I thought of using pattern matching, but it doesn't give the matched position, then how can I know where the excerpt starts and ends.

Your thoughts is greatly appreciated.

tschild

8:10 am on Feb 20, 2004 (gmt 0)

10+ Year Member



You can retrieve the match position with the pos() function.