Help me write a regular expression & lt; p & gt; 1. if you are happy today, I am not happy today & lt;/p & gt; & lt; palign = & quot; center & quot; & gt; 2. if you are not happy today, I will be happy & lt;/p & gt; write a regular expression, matching 2. if you are not happy today, I will be happy. the first p mark containing it will help you write a regular expression.
1. if you are happy today, I am not happy today.
2. if you are not happy today, I will be happy.
Write a regular expression to match. 2. if you are not happy today, I will be happy with the first p tag containing it, note that the p tag may have align = "center" or other domain names, and then replace it with null.
Thank you, younger brother!
------ Solution --------------------
Preg_replace ('/<[pP] [^ <] *? If you do not \ (happy \) today, I will be happy [^>] *? \/[PP]>/', '', $ str );