IP Address Regex — Validate IPv4 with Ranges
Debug JavaScript regular expressions live: highlighted matches, capture groups, flags, and replacement preview.
Processed entirely in your browser — nothing you enter here is ever uploaded.
Result
About this tool
This page opens with the classic strict IPv4 pattern: \b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b. Unlike the naive \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}, it validates every octet: 25[0-5] covers 250–255, 2[0-4]\d covers 200–249, 1\d\d covers 100–199, and [1-9]?\d handles 0–99.
The \b word boundaries on both ends matter more than they look: without them the pattern would happily match the 56.30.1.1 inside 256.300.1.1. The preloaded sample includes exactly such out-of-range addresses so you can verify that only real IPv4 addresses light up in the text.
This is the pattern to reach for when grepping access logs, filtering configuration files or validating input fields. Paste a chunk of your own logs into the test area — the match list below shows every address found together with its position, and the replacement mode lets you mask them, for example with a fixed placeholder.
Example. The pattern \d+ with no flags, applied to ab12cd34, highlights the matches 12 and 34.
Limit. Matching stops after 5000 hits, and the on-page list shows only the first 200.