How to use the Regex Tester
- 1
Enter a pattern and flags.
- 2
Paste test text.
- 3
Review matches and groups, and try a replacement.
Flags
g finds all matches, i ignores case, m makes ^ and $ match at line breaks, s lets . match newlines, u enables full Unicode and y makes the match sticky.
Patterns worth knowing
\d matches a digit, \w a letter, digit or underscore, \s any whitespace, and \b a word boundary. Quantifiers say how many: * zero or more, + one or more, ? optional, {2,4} between two and four. Parentheses capture a group you can reuse in a replacement as $1, and (?<name>...) gives it a name. For example, ^\d{4}-\d{2}-\d{2}$ matches a date like 2026-10-27.
Avoiding common traps
* and + are greedy: <.+> matches from the first < to the last > on the line. Add ? to make them lazy (<.+?>). A dot doesn't match line breaks unless you set the s flag, and ^ and $ only match at line starts and ends with the m flag. This tester uses your browser's JavaScript engine, so results match what your JavaScript or TypeScript code will do.
Frequently asked questions
Is my data sent to a server?
No. Everything runs in your browser as you type. Nothing is uploaded or logged, so it is safe to paste API responses, tokens and private text.
Will my pattern work in Python or PHP?
Most syntax is shared, but there are differences in lookbehind, named groups and flags. This tester follows JavaScript rules, so test in your target language's engine if it isn't JavaScript.
How do I match a literal dot or bracket?
Escape it with a backslash: \. \( \[ \? and so on. Inside a character class like [.], most characters don't need escaping.
How do I use a captured group in a replacement?
Write $1, $2 and so on, or $<name> for named groups. The replace preview shows the result as you type.
Something not working, or missing a setting you need? Report a problem or request a tool.