I am having trouble creating a regex in PHP whereby I need to extract all URLs beginning like
http://hello.hello/asefaesasef my name is
https://aw3raw.com/asdfase/
www.aer.com/afseaegfefsesef\
domain.com/afsegaesga"
I need to basically extract the URL until I hit a white space, a backslash (\) or a double quote (").
I have the following code:
$column = "adsfahttp://hello.hello/asefaesas\"ef asefa aweoija weeij asd sa https://aw3raw.com/asdfase/ asdafewww.aer.com/afseaegfefsesef\ even ashafueh domain.com/afsegaesga\"asdfasda";
preg_match_all("/(http|https):\/\/\S+[^(\"|\\)]+/",$column,$urls);
echo "Url = \n";
print_r($urls);
So I need my to extract so I have:
http://hello.hello/asefaesasef
https://aw3raw.com/asdfase
www.aer.com/afseaegfefsesef
domain.com/afsegaesga
I'm struggling to get my head around it as my result is showing as:
Url =
Array
(
[0] => Array
(
[0] => http://hello.hello/asefaesas"ef asefa aweoija weeij asd sa https://aw3raw.com/asdfase/ asdafewww.aer.com/afseaegfefsesef\ even ashafueh domain.com/afsegaesga
)
[1] => Array
(
[0] => http
)
)