Matching pair tag with regex
问题 I'm trying to retrieve specific tags with their content out of an xhtml document, but it's matching the wrong ending tags. In the following content: <cache_namespace name="content"> <content_block id="15"> some content here <cache_namespace name="user"> <content_block id="welcome"> Welcome Apikot! </content_block> </cache_namespace> </content_block> </cache_namespace> The content_block ending tag for id="welcome" actually get's matched as the ending tag of the first opening content_block tag.