Community Patterns

Community Library Entry

1

Regular Expression
Created·2023-11-22 15:10
Flavor·Python

r"
^((1\d{2}|2[0-4]\d|25[0-5]|[1-9]?\d)(\.(?=\d)|(?!\d))){4}(/([12]?\d|3[0-2]))?$
"
gm
Open regex in editor

Description

Strict validator for IPv4 with optional CIDR Disallows 00 in any octet

Submitted by ophers