Skip to content

Function.isValidIp

github-actions[bot] edited this page Nov 18, 2026 · 13 revisions

umt / isValidIp

Function: isValidIp()

isValidIp(ip): boolean

Defined in: IP/isValidIp.ts:12

Checks whether a string is a valid IPv4 address in dotted-quad notation

Parameters

ip

string

String to check (e.g., "192.168.1.1")

Returns

boolean

True if the string has exactly four decimal octets in the range 0-255 without leading zeros, false otherwise

Examples

isValidIp("192.168.1.1"); // true
isValidIp("192.168.01.1"); // false
isValidIp("256.0.0.1"); // false

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally