I'm looking for a decent regex to match a URL (a full URL with scheme, domain, path etc.)
I would normally use filter_var but I can't in this case as I have to support PHP<5.2!
I've searched the web but can't find anything that I'm confident will be fool-proof, and all I can find on SO is people saying to use filter_var.
Does anybody have a regex that they use for this?
My code (just so you can see what I'm trying to achieve):
return filter_var($url, FILTER_VALIDATE_URL);
return preg_match(REGEX_HERE, $url);
You could try this one. I haven't tried it myself but it's surely the biggest regexp I've ever seen, haha.