Possible Duplicate:
Best methods to parse HTML with PHP
I am putting together a WordPress template for a client that includes a PHP function in it that will preg_match_all a specific html tag as specified by the function.
For example if I pass the function the string "div" it will match all instances of div tags and their contents. The hard part with this is getting it match when there are obviously other tags nested within the div tag.
I have tried to work on this but with little success so there is not much point me putting up the regular expression I have so far.
If anybody is a genius an would be able to help me out I would appreciate it!