Przejrzelem juz wczesniej. narazie mam 2 takie fragmenty kodu ale zadnen nie zwraca tego co powinien:
Kod
$html='aaaaaaa http://to.jest.adres.com/test.html?zmienna=1 aaaaaaa';
preg_match_all("/(http[s]?):\/\/{1}([\w\.-]+)\.(\w{2,6}){1}/", $html, $matches);
print_r($matches);
preg_match_all('/(http|https):\/\/([^:\/\s]+)((\/\w+)*)(([\w\-\.]+\.[^#?\s]+)(.*?)(#[\w\-]+)?)?/',$html,$matches);
print_r($matches);
Zwraca:
Kod
Array
(
[0] => Array
(
[0] => http://to.jest.adres.com
)
[1] => Array
(
[0] => http
)
[2] => Array
(
[0] => to.jest.adres
)
[3] => Array
(
[0] => com
)
)
Array
(
[0] => Array
(
[0] => http://to.jest.adres.com/test
)
[1] => Array
(
[0] => http
)
[2] => Array
(
[0] => to.jest.adres.com
)
[3] => Array
(
[0] => /test
)
[4] => Array
(
[0] => /test
)
[5] => Array
(
[0] =>
)
[6] => Array
(
[0] =>
)
[7] => Array
(
[0] =>
)
[8] => Array
(
[0] =>
)
)