Skip to content

@technobuddha > library > RegExp > Validation

Function: isIPV4() ​

ts
function isIPV4(text: string): boolean;

Defined in: is-ipv4.ts:18

Determines whether the given string is a valid IPv4 address.

Parameters ​

ParameterTypeDescription
textstringThe string to test for IPv4 format.

Returns ​

boolean

true if the string is a valid IPv4 address, otherwise false.

Example ​

typescript
isIpV4('192.168.1.1'); // true
isIpV4('256.256.256.256'); // false
isIpV4('example.com'); // false