Skip to main content

is_same_domain

Return True if the host is either an exact match or a match to the wildcard pattern.

Any pattern beginning with a period matches a domain and all of its subdomains. (e.g. .example.com matches example.com and foo.example.com). Anything else is an exact string match.

def is_same_domain(
host: string,
pattern: string
) - > boolean

Return True if the host is either an exact match or a match to the wildcard pattern. Any pattern beginning with a period matches a domain and all of its subdomains. (e.g. .example.com matches example.com and foo.example.com). Anything else is an exact string match.

Parameters

NameTypeDescription
hoststringThe hostname string to be validated against the pattern
patternstringThe domain name or wildcard pattern (starting with a dot) to match against

Returns

TypeDescription
booleanTrue if the host matches the domain or subdomain pattern, False otherwise