Skip to content

Regex Tester

Test regular expressions with live matches, groups and flags.

Runs entirely in your browser

Your pattern and test string are matched by a worker inside your browser and are never uploaded.

Some regular expressions do not fail so much as hang: give a pattern like (a+)+b a long run of the letter a and the engine will chew on it for the rest of the afternoon. That is why every pattern here runs inside a Web Worker and never on the page itself. A pattern still going after two seconds is stopped by terminating the worker, and the tool tells you that catastrophic backtracking is the likely cause and how to make the repetition less ambiguous.

More about Regex Tester

Matching uses the JavaScript engine already in your browser, so what you see is what your own code will do. Every flag is a toggle with an explanation attached, including the newer u and v Unicode modes, which stay mutually exclusive because the engine rejects both at once. Paste a whole pattern with its slashes and flags and it splits itself into the pattern field and the flag row.

Each match is listed with its start and end offsets and its capture groups, named groups under their names and the rest by number, every one with its own position. The test string is shown beside the list with the matches marked by an outline as well as a tint, so the highlighting still reads in monochrome or with a colour vision deficiency. Five presets cover the patterns people usually arrive looking for.

  • Live matching with the JavaScript regular expression engine in your browser
  • Patterns run in a Web Worker, and a runaway one is stopped after two seconds
  • Toggles for the g, i, m, s, u, v and y flags, each with an explanation
  • Capture groups listed by name or number, with their own start and end offsets
  • Matches marked in the test string by outline as well as colour
  • A pasted pattern with slashes and flags splits itself into the two fields
  • Presets for email addresses, URLs, IPv4, ISO dates and UUIDs
  • Test strings up to one megabyte and patterns up to two thousand characters

How to use it

  1. 1Type your pattern between the slashes, or paste one complete with its flags.
  2. 2Switch flags on and off below the pattern; each explains itself on hover.
  3. 3Paste the text you want to search into the test string panel.
  4. 4Read the highlighted text and the match list, both of which update as you type.
  5. 5Check each match entry for its capture groups, their values and their positions.

Questions

Which regex flavour does this use?

The JavaScript engine built into your browser, unmodified, so the results match what your own code will do. Patterns written for PCRE, Python or Go may behave differently.

Is my test data sent anywhere?

No. The pattern and the text stay in your browser, and the matching runs in a worker thread on your own machine.

My pattern was stopped after two seconds, what happened?

That is almost always catastrophic backtracking, where nested repetition makes the engine try an exploding number of paths. Making the repetition unambiguous, for example writing a+ instead of (a+)+, normally fixes it.

Are named capture groups supported?

Yes, named groups appear in the match list under their names rather than a number. The ISO date preset uses them if you want to see the shape.

Why does the list stop at a thousand matches?

Matching halts at one thousand so a broad pattern on a large input cannot lock up the page, and the list says when that limit was reached. Narrow the pattern or shorten the test string to see the rest.

More Developer Tools
Esc

16 results