I need to capture content that is between a custom tag that has a default identifier, such as <:item>Conteúdo</item>
, but I'm not able to make the closing of this tag also customizable, and in the case I'm only getting this way : <:item>Conteúdo</end>
, keeping a default closing for all tags of the same content.
Current RegEx:
preg_match_all("~<:(.*?)>(.*?)</end>~si", $conteudo, $retorno);
What would be the regular expression for finding the opening tag and its relative closing tag? even if there is a parent-child hierarchy with the same tag name.