A regex tester lets you write a regular expression, run it against sample text, and instantly see every match highlighted along with its captured groups and positions. The tool above does exactly that in your browser: type a pattern, toggle the flags you need, paste some test text, and matches light up live. Nothing you type is transmitted anywhere.
What is a regular expression?
A regular expression (regex) is a compact pattern language for describing text. Instead of searching for one fixed string, you describe a shape — three digits, then a dash, then four digits; or a word followed by an at-sign and a domain. Regexes power find-and-replace in editors, input validation, log parsing, URL routing, and countless data-cleaning scripts. This tester uses the JavaScript engine, so what works here works in the browser and in Node.js.
How to use this tester
- Pattern — type the expression itself, without the surrounding slashes. For example, enter
d{3}-d{4}rather than/d{3}-d{4}/. - Flags — tick the modifiers you want. They change how the pattern is applied across the whole string.
- Test string — paste the text to search. Matches are highlighted in the right-hand pane as you type.
- Match details — every match is listed with its start and end index and each captured group, so you can confirm the pattern captures exactly what you expect.
The flags, in plain terms
| Flag | Name | Effect |
|---|---|---|
g |
global | Find all matches, not just the first. |
i |
ignore case | Treat upper and lower case as the same. |
m |
multiline | ^ and $ match at every line break. |
s |
dotall | The dot . also matches newline characters. |
u |
unicode | Correct handling of Unicode and code-point escapes. |
y |
sticky | Each match must begin exactly where the last one ended. |
A worked example
Suppose you want to pull email-like tokens out of a block of text. The pattern (w+)@(w+).(w+) with the g and i flags matches a run of word characters, an at-sign, a domain, a dot, and a top-level part. Run it against [email protected] and the tester reports one match, with group 1 = support, group 2 = quikconsole, and group 3 = net. Adding the i flag means [email protected] matches too, regardless of case. This is a teaching example, not a full email validator — real-world email rules are far more complex.
Common mistakes and how to fix them
- Forgetting to escape — a bare
.matches any character. Use.for a literal dot. - Greedy quantifiers —
.*grabs as much as possible. Use the lazy form.*?when you want the shortest match. - Missing the global flag — without
g, code using the pattern stops at the first match even though this tester shows them all. - Unbalanced brackets — a stray
(or[makes the whole expression invalid; the status line shows the engine error.
Is it safe to paste sensitive text here?
Yes — this tool never sends your pattern or test string anywhere. The matching happens with the browser’s native regex engine, on your machine, with no server round-trip, no logging, and no third-party analytics on this page. As with any online tool, treat truly sensitive data with care; you can load the page and then work offline, since everything runs locally.