First i'll find the first tag with this preg_match:
Code: Select all
$num = preg_match("/^(.*?)<([a-zA-Z\/][^ ]*?)( [^>]+)?>(.*)$/s", &$content, $startTag);Code: Select all
$num = preg_match("/^(.*?)<.".$this->__preg_quote($startTag[2]).">(.*)$/s", $startTag[4], $endTag);The $startTag[2] has the starting tag.
But when when you have a <table> in a <table> or any other nasted tag with the same name, it will take the wrong 'exit' tag.
Now i looked into this Recursive patterns, but i realy have no clue about how to fix this.
Now i searched allready, and only solutions are solving it with a recursive function. I think you can do this with Recursive patterns as well.