Regular Expressions 101

Community Patterns

IPv4 addresses that don't match RFC1918

0

Regular Expression
PCRE (PHP <7.3)

/
(\d+)(?<!10)(?<!127)\.(\d+)(?<!192\.168)(?<!172\.(1[6-9]|2[0-9]|3[0-1]))\.(\d+)\.(\d+)
/
g

Description

Matches publicly available IPv4 addresses (excludes 10., 172.16-32, and 192.168 blocks).

Submitted by anonymous - 8 years ago