<li class="page_item page-item-6"><a href="http://localhost/wordpress1006/?page_id=6">About us</a></li>
<li class="page_item page-item-12"><a href="http://localhost/wordpress1006/?page_id=12">Contact</a></li>
<li class="page_item page-item-10"><a href="http://localhost/wordpress1006/?page_id=10">Portfolio</a></li>
<li class="page_item page-item-8"><a href="http://localhost/wordpress1006/?page_id=8">Services</a></li>
I need to pull links only from this list, I would use regular expressions but I’m too scared to try.
So numbers will change at the end of page_item page-item-number
what would you suggest me to do here?
Thanks in advance
Try this:
Output:
(note it will fail on more complex HTML, in which case I would no longer use Regex, rather some thing like Simple HTML DOM)