PHP regexp to match a URL

http://snipplr.com/view/2371/regex-regular-expression-to-match-a-url/

$url = preg_replace(’@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@’, ‘$1‘, $url);

Comments are closed.