<?php
preg_match_all("/(href)([[:space:]]*=[[:space:]]*)('|\")(.*?)('|\")/is", $source, $matches, PREG_SET_ORDER
); ?>
Wyszukuje wartości spomiędzy atrybutów href. Regexp autorstwa mojego kumpla.
Przykładowa postać tablicy $matches:
Kod
Array
(
[0] => Array
(
[0] => href="http://onet.pl"
[1] => =
[2] => "
[3] => http://onet.pl
[4] => "
)
[1] => Array
(
[0] => href="http://wp.pl/"
[1] => =
[2] => "
[3] => http://wp.pl/
[4] => "
)
[2] => Array
(
[0] => href="http://google.com"
[1] => =
[2] => "
[3] => http://google.com
[4] => "
)
)
Można ją ograniczyć kasując niepotrzebne nawiasy w regexp'ie, ale sam się już w to pobaw