MatchHost Method  
 

Match a host name against one more strings that may contain wildcards.

Syntax

object.MatchHost( HostName, HostMask, [Resolve] )

Parameters

HostName
A string value which specifies the host name or IP address to match against the host mask string.
HostMask
A string value which specifies one or more values to match against the host name. The asterisk character can be used to match any number of characters in the host name, and the question mark can be used to match any single character. Multiple values may be specified by separating them with a semicolon.
Resolve
An optional boolean value which determines if the host name or IP address should be resolved when matching the host against the mask string. If this parameter is True, two checks against the host mask string will be performed; once for the host name specified and once for its IP address. If this parameter is False, then the match is made only against the host name string provided. If this argument is omitted, the default value is True.

Return Value

A value of True is returned if the host name or IP address matched the host mask. Otherwise, a value of False is returned which indicates that there was no match.

Remarks

The MatchHost method provides a convenient way for an application to determine if a given host name matches one or more mask strings which may contain wildcard characters. For example, the host name could be "www.microsoft.com" and the host mask string could be "*.microsoft.com". In this example, the function would return True, indicating the host name matched the mask. However, if the mask string was "*.net" then the function would return False, indicating that there was no match. Multiple mask values can be combined by separating them with a semicolon; for example, the mask "*.com;*.org" would match any host name in either the .com or .org top-level domains.

See Also

HostAddress Property, HostFile Property, HostName Property