Community Patterns

Community Library Entry

2

Regular Expression
Created·2021-09-22 11:58
Flavor·PCRE2 (PHP)

/
^(10(\.(1?\d\d?|2([0-4]\d?|5[0-5])))(?2)|172\.(1[6-9]|2\d|3[0-2])(?2)|192\.168(?2))(?2)$
/
gm
Open regex in editor

Description

Validate a given IP v4 address against all three defined Private IPv4 Subnets as statet in RFC1918

  • 10.0.0.0/8
  • 172.16.0.0/20
  • 192.168.0.0/16

Wikipedia Link RFC Link

Submitted by 0100101101001