0
I need to capture content that is between a custom tag that has a default identifier, for example: <:item>Conteúdo</item>
, but I’m not getting the closure of this tag to be customizable, and in this case I’m only getting it this way: <:item>Conteúdo</end>
, maintaining a standard closure for all tags of the same content.
Current regex:
preg_match_all("~<:(.*?)>(.*?)</end>~si", $conteudo, $retorno);
What would be the regular expression to find the opening tag and its relative closing tag? even if there is an inheritance of parents and children with the same tag name.
You intend to use the tag
<:item>
, or only the content?– Papa Charlie
if you are not required to use Regex, why not use Simplexml?
– Motonio
How do you mount this string? It has no pattern, neither XML, nor HTML...
– Papa Charlie