Skip to content

@technobuddha > library > RegExp > Validation

Function: isDomain()

ts
function isDomain(text: string): boolean;

Defined in: is-domain.ts:17

Determines whether the given string is a valid domain name.

Parameters

ParameterTypeDescription
textstringThe string to test as a domain name.

Returns

boolean

true if the string is a valid domain name, otherwise false.

Example

typescript
isDomain("example.com"); // true
isDomain("not a domain"); // false