从包含特定短语的文本中提取句子

I have a text document with 2 sentences:

stack overflow is the best. hello stack.

(the dot at the end indicate the end of the sentence.)

how to extract the whole sentence from text if the sentence contain the best

and output the whole sentence wich contain the best:

output: stack overflow is the best.

nothing tried. what regex should i use?

The below regex would match the text which contain best upto the next literal dot.

(?:^|\.)\K.*?(?=best)[^\.]*\.

DEMO

Prints all sentences containing the best w/o using regexes

$contents = file_get_contents("file.txt");
$sentences = explode('.',$contents);

foreach($sentences as $sentence) {
    if(false !== strpos($sentence,'the best'))
        print trim($sentence) . "
";
}

Demo