Regular expressions are the most powerful way to search and validate text — and the easiest to get subtly wrong. This tester shows every match live, so you can iterate on a pattern until it's exactly right.
Patterns, quantifiers and groups
Literal characters match themselves; metacharacters like . \d \w and [] define classes; * + ? and {} control repetition; and () capture groups you can refer back to. Building blocks combine into patterns that handle everything from emails to logs.
Greedy vs lazy
Quantifiers are greedy by default — they match as much as possible. Adding ? makes them lazy. When a pattern matches more text than you expect, the culprit is usually greediness.
Frequently asked questions
A regular expression (regex) is a pattern that matches text — used to search, validate and extract from strings. For example \d{4} matches any four-digit sequence.
g matches all occurrences instead of stopping at the first, i ignores case, m makes ^ and $ match at line boundaries, and s makes . match newlines too.
Patterns like a* can match empty strings. The tester skips them so the highlight stays clean; add a required character to avoid them.