I'm trying to delete tags from string:
"<p>string</p>" must be converted to "string"
I found solution for simply cropping first and last tags or all tags and then
"<p>string1</p><p>string2</p>" converts to "string1</p><p>string2"
I want to check string, something like
"IF last </p> tag is closing tag for first <p> tag THEN crop"
Is this possible to do with regex?
If no, I think formula must be something like: <p> tags equals 1, </p> equals -1.
I start to sum this numbers from end of string and stop when sum equals zero. If point where I stop is the end of string then it's one tag and I need crop it. Otherwise it's different tags.
But I don't know how to code it, help please.