This oughtta do the trick:
$url = "www.site.com";
if(eregi("(^ +)(www\..*)( +$)", $url)) {
return "http://" . trim($url);
}
Once mo', without the php wrappers, since they seem to bugger things up:
if(eregi("(^ +)(www..*)( +$)", $url) {
return "http://" . trim($url);
}
Have fun...