Extract URLs from Text

Extract all URLs from a text string.

Code

General
preg_match_all('/https?:\/\/[^\s]+/', $text, $matches);
return $matches[0];

Parameters

Text containing URLs

Server

More PHP Snippets