I am working with a string in TypeScript that follows the format subdomain.domain.com
. My goal is to extract just the domain part of the string. For example, subdomain.domain.com
should become domain.com
.
It's important to note that the 'subdomain' section of the URL can vary in size, so it could be 'subdomain.domain.com' or 'sub.domain.com'. Similarly, the domain itself may differ, such as 'subdomain.domain.com' or 'subdomain.new-domain.com'.
In order to achieve this, I need to remove everything up to and including the first '.' in the string. I hope that clarifies things!