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 Link to comment https://forums.phpfreaks.com/topic/159217-how-to-get-only-links-with-tags/ 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>"; Link to comment https://forums.phpfreaks.com/topic/159217-how-to-get-only-links-with-tags/#findComment-839722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.