← All tools
Regex Tester & Guide
Try a pattern against real text, see every match and group — with the cheatsheet built in.
Why this exists
Every grep over logs, every nginx location block, every Prometheus relabel rule is a regex — and they are write-only until you can watch them match. Test against your actual log lines here; the recipes load patterns from real ops work (nginx access logs, IPs, semver).
🔒 Runs in your browser — nothing is sent anywhere
//gm
2 matches
203.0.113.7 - - [25/Aug/2026:03:14:07 +0000] "GET /health HTTP/1.1" 200 512
198.51.100.9 - - [25/Aug/2026:03:14:09 +0000] "POST /api/v1/login HTTP/1.1" 401 87| # | match | groups |
|---|---|---|
| 1 | 203.0.113.7 - - [25/Aug/2026:03:14:07 +0000] "GET /health HTTP/1.1" 200 512 | $1=203.0.113.7 $2=25/Aug/2026:03:14:07 +0000 $3=GET $4=/health $5=200 $6=512 ip=203.0.113.7 time=25/Aug/2026:03:14:07 +0000 method=GET path=/health status=200 bytes=512 |
| 2 | 198.51.100.9 - - [25/Aug/2026:03:14:09 +0000] "POST /api/v1/login HTTP/1.1" 401 87 | $1=198.51.100.9 $2=25/Aug/2026:03:14:09 +0000 $3=POST $4=/api/v1/login $5=401 $6=87 ip=198.51.100.9 time=25/Aug/2026:03:14:09 +0000 method=POST path=/api/v1/login status=401 bytes=87 |
Characters
- any character except newline
- digit / not a digit
- word character [A-Za-z0-9_] / not one
- whitespace / not whitespace
- tab, newline
- a literal dot — escape any special character with \
Quantifiers
- zero or more
- one or more
- zero or one
- exactly 3
- 2 to 5
- lazy — shortest match instead of longest
Classes & groups
- any one of a, b, c
- anything except a, b, c
- ranges
- capture group with alternation
- group without capturing
- named capture group
Anchors & lookaround
- start / end of line (with the m flag) or text
- word boundary
- lookahead — followed by, without consuming
- negative lookahead
- lookbehind — preceded by
Flags
- all matches, not just the first
- case-insensitive
- ^ and $ match at every line
- . also matches newlines