Get the subdomain from a URL

Anyone have any great ideas besides storing a list of all TLDs? No, because each TLD differs on what counts as a subdomain, second level domain, etc. Keep in mind that there are top level domains, second level domains, and subdomains. Technically speaking, everything except the TLD is a subdomain. In the domain.com.uk example, “domain” … Read more

Characters allowed in a URL

EDIT: As @Jukka K. Korpela correctly points out, RFC 1738 was updated by RFC 3986. This has expanded and clarified the characters valid for host, unfortunately it’s not easily copied and pasted, but I’ll do my best. In first matched order: host = IP-literal / IPv4address / reg-name IP-literal = “[” ( IPv6address / IPvFuture … Read more