I have the following stored in a MySQL table:
<p>First paragraph</p><p>Second paragraph</p><p>Third paragraph</p><div class="item"><p>Some paragraph here</p><p><strong><u>Specs</u>:</strong><br /><br /><strong>Weight:</strong> 10kg<br /><br /><strong>LxWxH:</strong> 5mx1mx40cm</p><p>This is the paragraph I am trying to remove with regex.</p></div>
I'm trying to remove the last paragraph tags and content on every row in the table. I can loop through the table with PHP easily enough, but the regex has me stumped.
Every preg_match I've found on stackoverflow either gives me a "preg_match(): Unknown modifier" error, or the var_dump shows an empty array. I believe that would only match the content even if it did work so I think I need preg_replace?
The rows aren't identical in length, but it is always going to be the last paragraph that I want to completely remove.
Would appreciate if someone could show me how. Thanks
([^<]*)<\/p>$/', $description, $matches); var_dump($matches); - This just gives me an empty array.
– Will Jun 19 '15 at 02:16