Archive for June, 2009

PHP regexp to match a URL

Thursday, June 18th, 2009

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

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