<? $link = '<a href="http://www.google.com" id="external">google</a>'; preg_match_all("/<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>/siU",$link,$matches); print_r($matches[2]); ?>