CIDR to Regex & Range
Paste a CIDR subnet and I generate a regular expression matching exactly its IPs, the range (first–last), the total and examples. Great for grep on logs, ACLs and rules.
Regular expression
Anchored with ^…$ and dots escaped. Use it in
grep -E, egrep or log filters.
First —
Last —
Mask —
Prefix
/24
255.255.255.0
Addresses
256
254 usable hosts
Range
192.168.1.0
— 192.168.1.255
Tested examples
| IP | Matches? | Note |
|---|
Checked against the regex itself in your browser.
How to use it · grep, ACLs and filters
Runs locally in your browser · no sign-up · nothing leaves your browser