Networkingflags: g

IPv4 Address

Match valid IPv4 addresses with each octet constrained to 0–255.

Try it in RegexPro

Pattern

regexJavaScript
/(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)/g

Raw source: (?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)

How it works

Each octet alternation covers 250-255, 200-249, and 0-199 ranges to ensure strict 0-255 validity. Three octets with dots are matched, then the final octet.

Examples

Input

192.168.1.1

Matches

  • 192.168.1.1

Input

255.255.255.0

Matches

  • 255.255.255.0

Input

999.999.999.999

No match

Common use cases

  • Network configuration validation
  • Parsing server log files
  • Firewall rule generation
  • IP address extraction from text
All patternsTest this pattern live →