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? Link to comment https://forums.phpfreaks.com/topic/262979-regex-to-extract-url-with-special-characters/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.