Everything runs on your machine — your input is processed right here in your browser and never uploaded to any server.

Regex Tester

//g
Flags0 matches
Loading...

About this tool

Regular expressions are famously easy to get almost right: a pattern that matches your first example quietly fails on the edge case that reaches production. This tester shows you what a pattern does while you type it. Enter a JavaScript regular expression with any of the g, i, m, s, u and y flags, and every match in the test text highlights live, so a misplaced quantifier or greedy wildcard is visible immediately.

Below the editor, a table lists each match with its index in the text and every capture group it produced, both numbered and named. So you can confirm a log-parsing pattern captures the timestamp into the right group, or an extraction regex splits a URL correctly, before it goes anywhere near your codebase.

How to use

  1. Type your regular expression into the pattern field using JavaScript syntax.
  2. Toggle the flags you need: g for all matches, i for case-insensitive, m for multiline anchors, plus s, u and y.
  3. Paste sample text and watch matches highlight live as you edit either the pattern or the text.
  4. Review the match table, which lists each match with its index and every numbered and named capture group.
  5. Refine the pattern until highlights and captures are exactly right, then copy it into your project.

Both your pattern and your test text stay on your machine from the first keystroke. Matching runs on your browser's own regex engine, so nothing is sent to a server, and the log lines, emails or source snippets you test against are never visible to anyone else.

Frequently asked questions

Is this the same regex syntax as PCRE or Python?

Not exactly. It uses the JavaScript regex engine, which differs from PCRE and Python in places: there is no free-spacing x flag, and Python spells named groups differently. A pattern that works here will work in JavaScript, but retest in the target language before using it elsewhere.

How do I use named capture groups?

Write them as (?<name>pattern), for example (?<year>\d{4})-(?<month>\d{2}) to pull apart a date. The match table shows each named group with its label, and in JavaScript code the same values appear under match.groups.year.

Why is only the first match highlighted?

You probably have not enabled the g flag. Without it, a JavaScript regex stops after the first match it finds. Turn on g to find every occurrence; the highlights and the match table will update to show all of them.