Skip to content

Regex Tester

Test regular expressions live in your browser. Highlight every match, inspect captured groups and indices, toggle flags. Nothing you type is sent anywhere.

Runs entirely in your browser. Nothing you paste here is sent to us or anyone else — there is no server processing, no logging of input, and no third-party scripts on this page.

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.

Frequently asked questions

Is my pattern or test string sent to a server?

No. This tester compiles and runs your regular expression with the browser's built-in RegExp engine, on your device. Nothing you type is uploaded, logged, or stored. You can disconnect from the internet once the page has loaded and it still works.

Which regex flavour does this use?

It uses the JavaScript (ECMAScript) regular expression engine, the same one built into every modern browser and Node.js. Syntax such as \d, \w, character classes, lookahead, named groups, and the g, i, m, s, u, and y flags all behave exactly as they do in JavaScript.

What do the flags g, i, m, s, u and y mean?

g (global) finds every match instead of stopping at the first. i ignores case. m (multiline) lets ^ and $ match at line breaks. s (dotall) lets the dot match newlines. u enables full Unicode handling. y (sticky) forces each match to start exactly where the previous one ended.

Why do I see matches even without the g flag?

For highlighting and the match list, the tester scans the whole string so you can see every match at once. Your chosen flags still control matching behaviour (case, multiline, and so on) — the global scan only affects how many matches are shown, not how each one is matched.

How do capture groups appear?

Every parenthesised group in your pattern is listed under each match, numbered from 1. Named groups written as (?<name>...) are shown by name. A group that did not participate in the match is reported as undefined.

Do I need to escape special characters?

Yes. Characters such as . * + ? ( ) [ ] { } ^ $ | \ have special meaning. To match one literally, put a backslash in front of it — for example \. matches a literal dot rather than any character.

Why does my pattern say it is an invalid regular expression?

The engine could not compile it. Common causes are an unbalanced bracket or parenthesis, a dangling backslash at the end, a quantifier with nothing to repeat, or a duplicate flag. The status line shows the engine's own error message to help you locate the problem.

What is a zero-length match?

Some patterns — like a* or anchors such as ^ — can match an empty string at a position without consuming any characters. The tester marks these with a small caret so you can see where they occur, and it steps past them so the scan never loops forever.