I need a regex that will give me the following results from each example and I can't seem to get it right:
example.com
yields -> nothing / empty
www.example.com
yields -> nothing / empty
account.example.com
yields -> account
mywww.example.com
yields -> mywww
wwwboys.example.com
yields -> wwwboys
cool-www.example.com
yields -> cool-www
So, it doesn't matter if they use 'www' in the subdomain, but it can't be only 'www'. It can also contain hyphens.