Regex for IPv4 address matching in JavaScript

IPv4 addresses appear constantly in logs and configs. This pattern matches the dotted-quad shape; add range checks for strict 0-255 octets. Try it live below.

Working example
/(?:\d{1,3}\.){3}\d{1,3}/g

Try it live

The pattern and sample strings below are pre-loaded. Edit anything, or describe a variation in plain English and generate your own.

/(?:\d{1,3}\.){3}\d{1,3}/gvalid ✓

Tested live on the JavaScript engine. Other flavors are validated and flagged for differences, not executed.

No samples.

Related regex recipes