I have been mucking around with this for a couple of hours and cant seem to get it working.
If I have www or ftp.somedomain.net.nz or just somedomain.com and I want to extract just the somedomain from the pattern to set as a variable by echoing the hostname to sed
how would I go about it? 

For Example:

```
var="echo $HOSTNAME | sed 's/someregex to fit all$//'"

```