core.isvalidhostname
Home > @medplum/core > isValidHostname
isValidHostname() function
Tests whether a given input is a valid hostname.
__NOTE: Does not validate that the input is a valid domain name, only a valid hostname.__
Signature:
export declare function isValidHostname(input: string): boolean;
Parameters
Parameter  | Type  | Description  | 
|---|---|---|
input  | string  | The input to test.  | 
Returns:
boolean
True if input is a valid hostname, otherwise returns false.
### Valid matches: - foo - foo.com - foo.bar.com - foo.org - foo.bar.co.uk - localhost - LOCALHOST - foo-bar-baz - foo_bar - foobar123
### Invalid matches: - foo.com/bar - https://foo.com - foo_-bar_- - foo | rm -rf /