Test, validate and match regular expressions
Tokenizes full URLs into named capture groups: protocol, subdomain, domain, tld, ip, port, path, query, and hash. Matches either domain-based hosts (including optional subdomains and multi-part TLDs like .co.uk) or valid IPv4 addresses (each octet 0-255 via a reusable (?&segment) subroutine). Also handles optional ports, paths, query strings, and fragments including hashbang (#!) URLs. Ideal for URL parsing, validation, and extracting individual components in a single match.