Cheatsheet Pages / Regex Cheatsheet

A strict regex for IPv4 addresses — every octet really 0-255

The loose digit-count version happily accepts 999.999.999.999; you need every octet validated.

Patterns use the syntax shared by PCRE / Python / JavaScript; engine differences are flagged in the cheatsheet where they matter. Test any pattern at regex101.com — and pick the matching engine.

((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)
# matches: 192.168.1.1 — rejects 256.1.1.1
Regex Cheatsheet one-page card — patterns that actually work
The full one-page card — Regex Cheatsheet. Get the complete cheatsheet on GitHub