Regex Tester
Test and debug regular expressions live — highlight matches, inspect capture groups, toggle flags and try replacements.
Flags
Quick reference
- .
- any character
- \d \w \s
- digit, word, whitespace
- \D \W \S
- the negations
- ^ $
- start / end
- * + ?
- 0+, 1+, optional
- {n,m}
- n to m times
- [abc]
- any of a, b, c
- [^abc]
- none of those
- ( )
- capture group
- (?<n> )
- named group
- (?: )
- non-capturing
- a|b
- a or b
- \b
- word boundary
About the Regex Tester
This free regex tester lets you build and debug regular expressions against your own text and see exactly what matches, live as you type. Every match is highlighted in the test string and listed with its position and capture groups, so you can tell at a glance whether your pattern does what you intend. Toggle the standard flags — global, case-insensitive, multiline, dotall, unicode and sticky — and use the replacement field to preview a find-and-replace with $1, $& and named-group references.
It uses your browser's native JavaScript (ECMAScript) regex engine, so results match regex in JavaScript and Node.js precisely, and everything runs entirely in your browser — your pattern and text are never uploaded. Patterns are evaluated in a background worker with a timeout, so even an accidental catastrophic-backtracking expression can't freeze the page. It's handy for writing validation rules, extracting data, cleaning up text, or just learning how regular expressions behave.
Frequently asked questions
Answers to the questions we hear most about this tool.
How do I test a regular expression?
Type your pattern into the regex field at the top and type or paste the text you want to test into the test string box. Matches are highlighted in the text instantly as you type, and each match is listed below with its position and any capture groups. Use the flag checkboxes on the right to toggle options like global (find all matches) or case-insensitive matching. Nothing is sent anywhere — it all runs in your browser.
What do the regex flags g, i, m, s, u and y mean?
g (global) finds every match instead of just the first. i (ignore case) makes the pattern case-insensitive. m (multiline) makes ^ and $ match the start and end of each line rather than the whole string. s (dotall) lets the dot . also match newline characters. u (unicode) enables full Unicode handling, including \u{…} escapes and surrogate pairs. y (sticky) anchors each match to the position right after the previous one.
How do capture groups and named groups work?
Parentheses ( ) create a capture group, and each match in the list shows the text captured by every group, numbered from 1. Named groups written as (?<name>…) are shown by their name too, and you can reference them in the replacement field as $<name>. Use (?:…) when you want to group part of a pattern without capturing it.
Can I do a find-and-replace with regex?
Yes. Enter a replacement in the "Replace with" field and the result updates live. You can reference capture groups with $1, $2, …, named groups with $<name>, the whole match with $&, and use $$ for a literal dollar sign. With the global flag on, every match is replaced; without it, only the first. You can copy the replaced text with one click.
Which regex engine does this use, and is my text private?
It uses your browser's built-in JavaScript (ECMAScript) regular expression engine, so the behavior matches regex in JavaScript and Node.js exactly. Everything runs locally — your pattern and test text never leave your device. Patterns are evaluated in a background worker with a timeout, so even an accidental catastrophic-backtracking pattern won't freeze the page.
Related tools
JSON Formatter
Developer
Format, beautify, validate, minify, repair and explore JSON in a tree view — with key sorting, escaping and pinpoint error locations.
Open toolColor Converter
Developer
Convert colors between HEX, RGB, HSL, HSV, CMYK and OKLCH with a live picker, alpha, shades and harmonies.
Open toolColor Palette Generator
Developer
Generate harmonious color palettes and CSS gradients from any base color, then copy HEX, CSS variables or gradient code.
Open tool