I'm trying to use a regex with preg_split to separate a url from a string:
$body = "blah blah blah http://localhost/tomato/veggie?=32";
$regex = "(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)";
$url = preg_split($regex, $body);
The resulting array is:
array(2) (
[0] => (string) blah blah blah
[1] => (string))
I would like to return:
array(2) (
[0] => (string) blah blah blah
[1] => (string) http://localhost/tomato/veggie?=32)
Not sure what I'm doing wrong here...any advice will be appreciated.