Link1Link2'; preg_match_all('/href="([^"]+)"\s*>Link2/', $content, $matches); for($i = 0; $i < count($matches[0]); $i++) { echo $matches[1][$i]; } ?>