Regular Expressions 101

Community Patterns

1...45678...902

Community Library Entry

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 - 9 years ago