私はこのような文字列を持っています:
$string = "some text
http://dvz.local/index/index/regionId/28
http://stuff.kiev.ua/roadmap_page.php http://192.168.3.192/roadmap_page.php
http://192.168.3.192/roadmap_page.php#qwe";
すべてのリンクを取得する必要があります。
私はこの方法を試しました:/http:\/\/(.*)[|\s]?/
戻り値:
array(2) {
[0] =>
array(3) {
[0] =>
string(42) "http://dvz.local/index/index/regionId/28\r\n"
[1] =>
string(77) "http://stuff.kiev.ua/roadmap_page.php http://192.168.3.192/roadmap_page.php\r\n"
[2] =>
string(41) "http://192.168.3.192/roadmap_page.php#qwe"
}
[1] =>
array(3) {
[0] =>
string(34) "dvz.local/index/index/regionId/28\r"
[1] =>
string(69) "stuff.kiev.ua/roadmap_page.php http://192.168.3.192/roadmap_page.php\r"
[2] =>
string(34) "192.168.3.192/roadmap_page.php#qwe"
}
}
編集1:期待する:
array(2) {
[0] =>
array(3) {
[0] =>
string(42) "http://dvz.local/index/index/regionId/28"
[1] =>
string(77) "http://stuff.kiev.ua/roadmap_page.php"
[2] =>
string(77) "http://192.168.3.192/roadmap_page.php"
[3] =>
string(41) "http://192.168.3.192/roadmap_page.php#qwe"
}
[1] =>
array(3) {
[0] =>
string(34) "dvz.local/index/index/regionId/28"
[1] =>
string(69) "stuff.kiev.ua/roadmap_page.php"
[2] =>
string(69) "192.168.3.192/roadmap_page.php"
[3] =>
string(34) "192.168.3.192/roadmap_page.php#qwe"
}
}