Hi,
I've to check if a string contains the hostname
my 5 cents and it seems to work but not being at all
a regex guru .....
Code JavaScript:
var re = new RegExp(window.location.hostname,'i');
alert(re.test(str));
str can be like:

http://www.mydomain.com/
http://www.mydomain.com
www.mydomain.com/
http://www.MYdomain.com/
www.mydomain.com/action/id/12
www.mydomain.com?id=12
sub.mydomain.com


and so on ....