mars_rahul Posted December 17, 2007 Share Posted December 17, 2007 i use preg_match function to select the links from the string. that is fine for all types of links but my problem is a bit different. i have different types of links in my string. such as: - 1. Internal links of my website.(refers to the next page link). admin/index.php. 2. Other links in website a). Refers to name of my website that is say: - www.xyz.com b). Refers to external link. such as www.google.com. here is the code: - <?php $str = "this is the content. <a href = http://www.google.com>For google</a>. links to my own website is as <a href://www.xyz.com>My website</a> with other internal link as <a href= "admin/index.php"> for admin panel</a>"; ?> now i only want to extract those links that are www.xyz.com (that is my own website) with all its internal links (describes as admin panel as above). is there anybody to help me out. Quote Link to comment Share on other sites More sharing options...
effigy Posted December 17, 2007 Share Posted December 17, 2007 What pattern are you currently using? If your internal links do not use an absolute URL, you can use a negative lookahead: href="(?!http:)...". 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.