I need to find a sentence or sentences that is/are surrounding a string. That will be from the first capital letter or break line to the end point or break line.
What I got is this but of course is not working at all:
$search_string='example';
$regex = '\[A-Z]{1}[a-z]*\s*'.$search_string.'\s*[a-zA-Z]*\i';
preg_match_all($regex, $content, $matches);
If the word is repeated in more than on sentence i will need to retrieve both sentences. I'm not sure if im explaining it well; please comment and I will try to explain it again.
EDIT
I have a wordpress website with lot of post and pdf, docs, etc inside those post. Im using a searchengine called swish-e to index all and display results. When someone search for any string i want to display a summary of that string instead of the full post/ or pdf.
So if a user searchs "example" string, i need to show all the sentences or at least a few of them where the word example appears. That´s why i asked for a capital letter at beggining and the end point at the end. I know this wont be perfect but at least i need to cover some scenarios (Capital letter / break lines, etc)
Hope its more clear, once again thanks a lot