Test regular expressions against text with live match highlighting. Pure client-side.
Text · patterns · JavaScript regex
Test regular expressions against sample text with live match highlighting and capture groups. Iterate on patterns in the browser using the same JavaScript RegExp engine your front-end code will use.
Regular expressions describe search patterns: validate an id format, extract a field from a log line, or prototype a replace before running it on a large corpus. A live tester shortens the loop — change the pattern, see matches immediately — without redeploying an app or writing a one-off script.
This page uses your browser’s ECMAScript regex implementation. That is ideal when the destination is JavaScript or TypeScript. It is not a perfect stand-in for PCRE, Python re, Go regexp, or Java Pattern, which differ on lookbehind, possessive quantifiers, unicode classes, and more.
g, i, m, s, u.| Flag | Effect |
|---|---|
g | Global — find all matches, not only the first |
i | Case-insensitive |
m | Multiline — ^ / $ per line |
s | Dotall — . matches newlines |
u | Unicode mode for code-point aware patterns |
y | Sticky — match from lastIndex |
Simple email-shaped check (illustration only — production email validation is harder):
Pattern: ^[^@\s]+@[^@\s]+\.[^@\s]+$
Flags: i
Text: dev@example.com
Capture an ISO date from a log line:
Pattern: (\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})
Text: level=info ts=2026-03-01T14:22:10 msg=started
Group 1 is the date, group 2 the time. Named groups ((?<name>…)) work in modern browsers when you need clearer code.
Don’t parse HTML or full JSON with regex. Nested structure needs a real parser. Regex is brittle for balanced tags and escaped quotes. Use it for flat tokens and line-oriented text.
Some patterns (especially nested quantifiers like (a+)+$ on long a…aX strings) can run in catastrophic backtracking time. In servers that accept user-supplied regex, that is a denial-of-service risk (ReDoS). Prefer possessive-style thinking, atomic grouping where available, or non-regex parsers for untrusted input. In this browser tool, a runaway pattern may freeze the tab — keep samples realistic.
Dialect differences. Retest in the runtime you ship (and with the same flags). Port patterns carefully around lookbehind, unicode properties, and substitution syntax.
/pattern/gi?In code, JS literals use slashes. This UI uses separate pattern and flags fields — paste the body of the pattern and set flags explicitly.
No. Matching runs locally. Privacy Policy.