I'm trying to lift some data out of an html file. Basicall, I'm trying to get all info between <li class="free"> and it's corresponding </li>
The following works for the most part, however under certain circumstances, there is another <ul><li></li></ul> set nested inside the <li> set I am trying to pull.
It grabs from my opening tag to the first </li>.
The initial regex is:
Code: Select all
preg_match_all('%<li\\sclass="free">(.*?)</li>%si', $html, $result, PREG_SET_ORDER);I had high hopes for
Code: Select all
preg_match_all('%<li\\sclass="free">(.*?(?:<li>.*?</li>)*?)</li>%si', $html, $result, PREG_SET_ORDER);Any ideas on how to accomplish what I'm after?
Thanks