Regex Tester

Test a JavaScript regular expression and inspect matches, capture groups and indexes.

Input

Processed on your device

How to use Regex Tester

Try a JavaScript regular expression on sample text and inspect what it matches. Use it to build a data-cleaning rule, verify a capture group or check whether a pattern handles alternate cases before adding it to your program.

  1. Place the sample in Source text.
  2. Enter the pattern without wrapping slashes in Regular expression and put modifiers such as g and i in Flags.
  3. Test and read the match positions and capture values in the result.
  4. Select Test pattern and review the result.
Example input
Invoice 7834 belongs to order A104.
Invoice 7835 belongs to order A105.

Example use

To find invoice numbers, use a short sample containing two records and the pattern Invoice followed by a space and a digit capture. Run it with g to find both records. Add a line that should not match so you can check false positives before using it on a full file.

Output and compatibility

The results reflect JavaScript’s regex engine, which can differ from PCRE, Python, grep or database dialects. The tool reports matches and groups, including named groups when the pattern defines them. It does not rewrite or replace the text here.

Troubleshooting

If you expect multiple matches but see one, check for the global flag. If a pattern behaves differently when copied into a JavaScript string literal, inspect how that literal escapes backslashes. A very slow pattern may need a smaller representative input or a simpler expression.

Try Text Compare to review the original and edited versions after applying your replacement rule.

Frequently asked questions

What goes in the Flags field?

Enter supported JavaScript flags such as g for all matches or i for case-insensitive matching, without slashes.

Can I get named capture groups?

Use JavaScript’s named group syntax and inspect the groups in the output.

Does this match Python regex syntax?

JavaScript defines the result here. Verify any expression in the actual target engine before relying on it.

How can I replace the matches?

Open Find and Replace Text and choose Regular expression for a replacement operation.

Can I test whole lines instead?

Try the needed start and end anchors with the multiline flag, or use Extract Matching Lines to return full matching lines.

Where does my sample text go?

The browser tests it locally.

Find a tool