TECHY WARNING: This post has 'techy talk' be warned
We have just been working on Halogy and making a Javascript and PHP function that tidies domain names. We thought we would share it!
If you want to remove the 'http://www' from a string, or even just the 'www' or the 'http://' use this really nifty regular expression:
// get the old untidy domain string and tidy it
$str = 'http://www.haloweb.co.uk';
$newStr = preg_replace('/^(http)s?:\/+((w+)\.)?|^www\.|\/+/i', '', $str);
// and this will output your new tidy string!
echo $newStr;

