Developer

Regex Tester

Test a regular expression against your text, with every match, group and a warning for catastrophic backtracking.

Runs entirely in your browser. Nothing you paste is uploaded.

/ /g

This runs entirely in your browser, using the same regular expression engine your JavaScript will use.

How to use it

  1. Put your expression in the pattern field, and your text below itThe pattern field takes the regular expression on its own, without the surrounding slashes some languages use. The larger box below takes the text you want to match against. Everything happens inside your browser β€” nothing is uploaded, so there is nothing for us to store, log or lose.
  2. Read the result as it updatesThere is no button to press. Matches highlight in the text as you edit either box. The output recomputes every time you change the text or one of the options above it.
  3. Read the numbered groupsEvery capture group is listed per match, which is usually what you actually wanted from the expression. Named groups are shown by their name.
  4. Check the flagsGlobal, case-insensitive and multiline change the answer substantially. Multiline in particular changes what ^ and $ mean, which is behind a great many patterns that "should work".
  5. Notice the warnings about catastrophic patternsSome expressions take exponential time on certain inputs. Where that shape is detectable the tool says so, because that class of bug takes a server down rather than returning a wrong answer.
  6. Copy or download the resultThe buttons under the output put it on your clipboard or save it as a file, and each one says exactly what it will copy or download. Any note about something the tool changed or deliberately left alone is shown with the result rather than hidden.

About this tool

Write a regular expression and see what it matches, as you type. Every match is highlighted in your text, and each one is listed with its position and its capture groups.

It runs on your browser's own regular expression engine β€” the same one your JavaScript will use. That matters more than it sounds: PCRE, .NET, Python and JavaScript genuinely disagree about lookbehind, named groups and Unicode escapes, so a tester built on a different engine can confidently show you a match your code will never make.

Understanding the result

The highlighted text shows every match in place. The table below lists each one with its offset and the contents of each capture group, including groups that did not participate β€” which is different from a group that matched an empty string.

A pattern that nests one quantifier inside another gets a warning before you run it. That shape can take exponential time on input that nearly matches, which is the denial-of-service bug known as ReDoS.

Matching stops after 1,000 matches or one second, whichever comes first, and says so rather than appearing to hang.

Example

Input

Pattern: (?<user>\w+)@(?<host>[\w.]+)   Β·   Text: rasu@roftr.com

Output

1 match at 0: rasu@roftr.com
  user: rasu
  host: roftr.com

Limitations

  • This is the JavaScript flavour of regular expressions. If your pattern is destined for PHP, Python, Go or a database, check its own documentation for lookbehind and Unicode property support.
  • The backtracking warning is a heuristic. Proving a pattern is safe is undecidable in general, so an absent warning is not a guarantee β€” it catches the common dangerous shapes, not all of them.
  • Very large inputs are bounded by your browser's memory and by the limits above.
  • Replacement uses JavaScript's rules, where `$1` inserts a capture group and an unknown group number silently becomes empty text. The tool points that out rather than letting it pass unnoticed.

Questions

Is my pattern or test text uploaded?

No. The whole tool is JavaScript running on your device β€” there is no request to send. You can confirm it by opening your browser's network tab, or by disconnecting from the internet and using the page anyway.

Why does my pattern work here but not in my code?

Usually the flags. A pattern that finds every match here has the global flag set; without it, most languages return only the first. After that, check whether your language needs the pattern as a string, which means doubling every backslash.

What is catastrophic backtracking?

When a pattern can match the same text in many different ways, the engine tries all of them before giving up. With nested quantifiers the number of ways grows exponentially with the input length, so a 30-character string can take longer than the age of the universe. It is a real denial-of-service vector β€” a user-supplied string against a vulnerable pattern can take a server down.

Can I use this on real data?

It never leaves your browser, so the tool adds no exposure. Note that the matched text is displayed on screen, so the usual care about shoulder-surfing and screen sharing applies.

Last updated 2026-08-16.

Related tools