Created
July 5, 2013 08:59
-
-
Save zhdanovartur/5933089 to your computer and use it in GitHub Desktop.
Регулярное выражение для поиска всех атрибутов href у ссылок.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; | |
if(preg_match_all("/$regexp/siU", $input, $matches)) { | |
// $matches[2] = array of link addresses | |
// $matches[3] = array of link text - including HTML code | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment