abhi_madhani Posted May 23, 2012 Share Posted May 23, 2012 I am trying to extract URL's from html page by using following Regular Expression. <a href=" (....till....) "> Name </a> preg_match_all('/<\s*a\s+[^>]*href\s*=\s*[\"\']?([^\"\'>]+)[\"\']>(.*)<\/a>/isU' It works perfectly on most URL's. But it fails to recognise following kind of urls in HTML. http://en.wikipedia.org/wiki/B'ham - Note the single quotation in the B'ham. The URL's in the HTML are not encoded for special characters, hence I have to build my regex to count in URL's which have special characters in them. Could anyone guide me for solutions towards this bend? 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.