I have a series of string that could either be:
1: google.com 2: www.google.com 3: finance.google.com
What I need to do is basically add a www. to any string that doesn’t have a subdomain already attached to it.
So in this case, we should add a www. infront of string #1 (google.com) but leave #2 and #3 alone.
What do you think would be the best way to accomplish this? Some form of REGEX?
You can’t because there is no specific rules (how many subdomains, for instance you.can.have.lot.of.dots.com …), and you can’t know that http://www.yourdomain.com is equal to yourdomain.com