PHP: How do I remove nested tags, and relocate them in an un-nested way?
问题 I need to remove all occurrences of a bb style tag from a string. The tags can be nested, and this is where I am failing. I also need to relocate each tag and contents to the end of the string, and replace the tag with an HTML element. I have tried to play with regex and preg_replace_callback, but I have only been so far unsuccessful. I also tried to modify the following, and have also had no luck: Removing nested bbcode (quotes) in PHP and How can I remove an html element and it's contents