I have a long block of text ($oldText), and I need to insert a second block of text right after the first paragraph. Paragraphs are divided by <br /><br />, except there's a line break between them. The goal is to insert $newText right after the first two line breaks.
So, I wanted to do something like this:
$pattern = '<br />\n<br />';
$completeText = preg_replace('$pattern', '$pattern.$newText', '$oldText', 1);
echo $completeText;
But, it didn't work, probably because I'm struggling with regular expressions.
Can anyone help me with this one?
Thanks.