Regex issue: capturing nested html container tags
| From: | Geoff Caplan | Date: | Thu, 17 Apr 2003 12:03:35 +0000 |
| Subject: | Regex issue: capturing nested html container tags | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144273@lists.php.net to get a copy of this message | ||
Hi folks,
I am trying to build a regex that will capture an entire html
container tag, such as <table> ... </table> including any tables
nested inside, to an arbitrary depth of nesting.
In other words to capture
foofoofoo(<table><table></table></table>)barbarbar
Not an unbalanced string
foofoofoo(<table><table></table>)</table>barbarbar
I think this can be done using the preg recursive patterns facility,
but I would be very grateful if anyone who has solved this already was
prepared to share their code.
Thanks
--
Geoff Caplan
Advantae Ltd