Regex Cheatsheet - Regular Expression Quick Reference

Quick reference for regular expression patterns. Character classes, quantifiers, anchors, and common patterns.

Share
Back to Regex Cheatsheet

IPv4 Address Pattern

Common Pattern

Match IPv4 address (0.0.0.0 - 255.255.255.255)

Pattern

^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$

Syntax

Explanation

Strictly validates each octet between 0-255.

Examples

192.168.1.1

LAN IP

Matches: 192.168.1.1

255.255.255.0

Subnet mask

Matches: 255.255.255.0

127.0.0.1

Localhost IP

Matches: 127.0.0.1

Related Patterns

Related Tools

More Text Tools