I'm having problems to get a part of text only if it contains a substring. What i want to do is, given the next example:
1 - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
2 - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut et dolore magna aliqua."
And with a substring like "labore", get "labore" and the prev and next 20 characters:
1 - "...empor incididunt ut labore et dolore magna ali..."
Edit: I am developing the search box for a website, so given a word i want to return all the paragraphs who contains that word, but the paragraphs are long so i want to return only a part of it.