t_machine Posted May 22, 2009 Share Posted May 22, 2009 Hi, I am trying to parse a page that contain many links. There are links on there with <h2> tags which are the ones I need. How can I get only those links? I am using the following but it returns every link. $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; The <h2> links on the page are like the following: <a href="link to page"><h2>LINK NAME</h2></a> Thanks for any help Quote Link to comment Share on other sites More sharing options...
Masna Posted May 22, 2009 Share Posted May 22, 2009 $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*><h2>(.*)<\/h2><\/a>"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.