Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Created·2025-10-28 09:57
Flavor·JavaScript

/
^(25[0-5]|2[0-4][0-9]|1?[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1?[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1?[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1?[1-9]?[0-9])$
/
gm
Open regex in editor

Description

An IPv4 expression that doesn't allow leading zeros in octets. 10.0.0.1 will pass 10.0.0.01 shouldn't pass

Submitted by machfist