About IPv4 Address Regex Tester
This page opens with a pattern that checks each of the four parts of an IPv4 address is between 0 and 255, so 192.168.0.1 matches and 256.100.1.1 does not. It is free, needs no sign-up and runs in your browser, so nothing you enter is uploaded.
On the sample text it finds 3 addresses: 192.168.0.1, 8.8.8.8, 255.255.255.255. Each part uses the alternatives 25[0-5], 2[0-4]\d and 1?\d?\d to cover 250 to 255, 200 to 249 and 0 to 199.
The pattern accepts a leading zero such as 01, which some systems read as octal. IPv6 addresses need a different pattern.
How to use IPv4 Address Regex Tester
- Type or paste a regular expression into the pattern field, or pick one from the Try chips: email, URL, phone, date, IPv4 or hex colour.
- Toggle the flags you need: g for all matches, i to ignore case, m for multiline, s so the dot matches line breaks, u for Unicode and y for sticky.
- Paste your test text. Matches are highlighted as you type.
- Read the table under the tester for each match, its position, and its numbered and named groups.
- Switch to Replace to try a replacement string. Use $1, $2 and $<name> to reuse groups, then copy the result.
- Read "What the pattern means" to check the pattern does what you think.
Features
- JavaScript regex flavour with flags g, i, m, s, u and y.
- Live highlighted matches, with alternating colours so neighbouring matches stay distinct.
- Numbered and named capture groups in a table.
- Replace mode with $1, $<name> and $& in the replacement.
- A plain-English explanation of every token, with groups indented.
- A small pattern library with real test strings.
- Catastrophic backtracking protection: matching runs in a Web Worker and is stopped after a short time limit.
- Clear error messages for an invalid pattern.
Worked examples
\b(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)\b gives 192.168.0.1 | 8.8.8.8 | 255.255.255.255
256.100.1.1 and 1.2.3 are not matched.
Privacy: how it works
- The pattern and the text are processed by code in this browser tab. Nothing is sent to Ulkaa or to any other server.
Tips
- Escape the special characters . * + ? ( ) [ ] { } ^ $ | \ with a backslash when you mean them literally.
- Prefer specific classes over the dot: [^"]* is faster and safer than .* when matching up to a quote.
- Anchor a validation pattern with ^ and $, or it will match a valid piece inside invalid text.
- Turn on the m flag when your text has several lines and you want ^ and $ per line.
Frequently asked questions
Is it really free?
Yes. There is no price, no trial and no credit card. Ulkaa Tool does the work with your own device, so there is no server bill to pass on to you.
Do I need an account?
No. There is no sign-up and no login. Open the page and use it. An Ulkaa account is not needed for anything on this tool.
Does it run in my browser?
Yes. Your pattern and text are processed by code running in your browser tab, on your own device.
Is my data uploaded?
No. Your pattern and text are never sent to Ulkaa or to anyone else. You can check this yourself by watching the Network tab in your browser developer tools while you use the tool.
How does the regex limit each part to 255?
It lists the allowed ranges as alternatives: 25[0-5] for 250 to 255, 2[0-4]\d for 200 to 249, and 1?\d?\d for 0 to 199.
More Regex Tester pages
- Regex TesterType a pattern and some text, and see every match, group and replacement as you type.
- Email Validation RegexCheck which lines look like an email address, and see why the others do not.
- URL Regex TesterFind web addresses in a block of text with a pattern you can edit.
- Phone Number Regex TesterMatch phone numbers written with brackets, dashes, dots or spaces.
- Date Regex TesterMatch YYYY-MM-DD dates and rewrite them with named groups.
- Hex Color Regex TesterFind #rgb and #rrggbb colours in a stylesheet or text.
- Password Strength RegexSee which sample passwords pass a rule built from lookaheads.
- Remove Extra Spaces With RegexReplace runs of whitespace with a single space.
- Extract Numbers With RegexPull every number, including decimals and negatives, out of text.
- Regex Replace With Capture GroupsReorder words with $1 and $2 in the replacement.
- Regex Named Groups TesterCapture the level, service and message of a log line by name.