Skip to main content
Regexflux

Private IP Address (RFC 1918)

intermediate

Matches private/internal IPv4 addresses.

securityipprivatenetwork

Pattern

/\b(?:10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3})\b/g

Try It

0 of 8 strings matched

Explanation

Matches RFC 1918 private IP ranges: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Used to detect internal network addresses in logs or configs.

Test Strings

Matching

  • 10.0.0.1
  • 172.16.0.1
  • 192.168.1.1
  • 172.31.255.255

Non-matching

  • 8.8.8.8
  • 172.15.0.1
  • 172.32.0.1
  • 192.169.1.1

Language Compatibility

LanguageSupport
JSFull support
PYTHONFull support
JAVAFull support
PHPFull support
GOLimited support (ASCII-only word boundaries)

Code Snippets

const regex = /\b(?:10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3})\b/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);

Related Patterns