I’ve got a column that has some <p> tags like:
<p>test test 2</p> <p>this is a test 2</p> <p>this is a test 3</p>
What is the best way to always remove the first <p> with corresponding </p>.
So that the result becomes:
test test 2 <p> this is a test 2 </p> <p> this is a test 3</p>
It should work for any case even <p>1</p> it should result in just 1.
I tried using CHARINDEX and SUBSTRING but I end up with a lot of hardcoded #’s :(.
It’s ugly, but it should work. The code basically finds the first instance of
</p>and gets everything to the right of it. It also gets everything to the left of it, replacing the first<p>it finds.This should return:
And
EDIT:
Based on this question here, how about: