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.