Regex Tester
Test regular expressions with live match highlighting
🔒 100% бесплатно · без регистрации · файлы не покидают ваше устройство
A regular expression is easy to write and hard to trust. The pattern that pulled every order id out of a log yesterday quietly skips the ones with a hyphen today, and reading the expression again rarely reveals why. The fastest way to find out is to run it against real text and see exactly which characters it consumed.
This regex tester does that as you type. Every match is highlighted in place inside your test string, and the table underneath lists each one with its start and end index, the matched text, and the value of every capture group — numbered groups and named (?<name>...) groups alike. Flags g, i, m, s, u and y are one click away, so it takes seconds to check whether a missing g flag is why you only got one result. Invalid patterns produce a plain-English explanation instead of a raw engine error, and a pattern that nests quantifiers is paused with a warning rather than allowed to lock up the tab.
Зачем нужен Regex Tester
Building a validation rule
Draft an email, phone or postcode pattern and paste in twenty real examples at once to see which ones fail before the rule reaches production.
Extracting fields from log lines
Wrap the interesting parts in capture groups and confirm each group picks up the right timestamp, level and message across many lines.
Checking a find-and-replace before you run it
Highlighting shows precisely which characters a pattern would replace across a whole file, so a greedy quantifier does not silently eat too much.
Debugging a pattern that hangs
If a pattern nests quantifiers, the tool names the risky fragment before running it, so you find the ReDoS problem instead of freezing the page.
Полезные советы
- Without the g flag a regex returns only the first match — that alone explains most 'my regex only finds one result' reports.
- Prefer lazy quantifiers (.*?) when matching between delimiters; greedy .* runs to the last delimiter on the line.
- Nested quantifiers like (a+)+ cause catastrophic backtracking. Rewrite them with a more specific character class instead.
- Named groups (?<year>\d{4}) make patterns readable and give you match.groups.year in JavaScript instead of a numeric index.
- The m flag changes what ^ and $ mean, while the s flag changes what . matches — they solve different multi-line problems.
Как пользоваться: Regex Tester
- 1Type your regular expression in the pattern field
- 2Toggle the flags you need, such as g and i
- 3Paste the text you want to test against
- 4Read the highlighted matches and capture groups below
Часто задаваемые вопросы
Which regex flavour does it use?▾
The JavaScript engine built into your browser, so results match exactly what your own JavaScript or TypeScript code will do.
Can a bad pattern freeze the page?▾
No. Patterns that nest quantifiers are paused with a warning before they run, and matching also stops at a match cap and a short time budget.
Are named capture groups supported?▾
Yes. Groups written as (?<name>...) are listed by both their number and their name for every match.