There is a line:
8768 text text text 868123 text text text.text 9875 text text 2353 text text And there is such a request:
~(8768|9875|2353).*~iu However, I only get what is on the line, but I need all the information until I see \n\n or the end of the whole text. And the main thing is to glue it all together.
sflag and / or explicitly specify\n\nin the expression. And also indicate what you are working with regulars. Well, and at the same time more fully describe the task, because nothing is clear - Mikepreg_replace('~(8768|9875|2353).*(?:\R(?!\R).*)*~u', '', $str), orpreg_match_all('~(8768|9875|2353).*(?:\R(?!\R).*)*~iu', $str, $ms). Please add the desired result to the question. - Wiktor Stribiżew