Developer & text tools

Regex Tester & Match Extractor

Test regular expressions against real text. Highlight matches, inspect numbered and named capture groups, preview find-and-replace operations, and export the results. Matching runs locally in your browser.

Build your expression

Enter a JavaScript regex pattern without the surrounding slash delimiters, then select the flags to use.

Maximum 2,000 characters. The pattern uses JavaScript regex syntax.
Flags
/pattern/gu

Quick examples

Load a working example to test common extraction and replacement tasks.

Maximum 50,000 characters per run. Large samples or complex patterns may take longer.
Common substitutions include $& for the entire match, $1 for capture group 1, $<name> for a named group and $$ for a literal dollar sign.

Ready to test.

Test result

The match list is capped at 300 entries to keep the interface responsive.

Matches shown 0
Input characters 0
Runtime —
Enter a pattern and test text, then select Test regex.

Highlighted matches

Highlighting shows the matched ranges for the displayed matches.

Your highlighted text will appear here.

Match details & capture groups

Match positions are zero-based JavaScript string indexes. Numbered and named capture groups are listed when present.

No results yet. Run a regex to inspect matches.

Regular expression cheat sheet

These examples use JavaScript syntax. Exact behavior can differ between regex engines.

Pattern Meaning Example
.Any character, except line terminators unless dot-all is enableda.c
\dASCII digit\d{4}
\wASCII word character in common usage\w+
\sWhitespace character\s+
[abc]One character from the set[aeiou]
[^abc]One character not in the set[^0-9]
{2,4}Repeat the previous item 2–4 times\d{2,4}
(...)Capturing group(\d{4})
(?:...)Non-capturing group(?:https?|ftp)
(?<year>...)Named capturing group(?<year>\d{4})
^ and $String boundaries, or line boundaries with multiline flag^Hello$
\bWord boundary\bcat\b
(?=...)Positive lookahead\d(?=px)
(?!...)Negative lookaheadfoo(?!bar)

How to use this regex tester

  1. Enter the expression without surrounding slash delimiters.
  2. Choose the flags, such as global matching and case-insensitive matching.
  3. Paste the text you want to inspect and run the test.
  4. Review the highlighted matches, indexes and capture groups.
  5. Optionally enable replacement preview, then copy or export results.

Understanding regex flags

What are capture groups?

Parentheses can capture part of a match. Numbered capture groups are assigned from left to right, while named groups label the captured values. For example, (?<year>\d{4})-(?<month>\d{2}) creates named captures for a four-digit year and a two-digit month.

Testing a pattern is not the same as validating the data

A regex can check whether a date string resembles 2026-10-17 without confirming that every matched date is a real calendar date. Similar limits apply to email addresses, URLs and phone numbers. Use a domain-specific validator when the actual value must be correct.

Why the tool has a timeout

Some regex patterns can take a long time on certain input strings. This tool runs matching in a separate temporary Web Worker and stops it after a time limit. That reduces the risk of a slow pattern freezing the page, but it does not guarantee that every expression is safe or fast.

JavaScript syntax versus other regex engines

This tester uses your browser's JavaScript RegExp engine. Patterns written for Python, PCRE, Java, .NET, Ruby or other engines may behave differently. If your production code uses another engine, test the expression in a tool that supports that particular flavor.

Frequently asked questions

Why is only one match shown?

Without the global flag g, JavaScript matching typically stops after the first result. Enable the flag when you want all non-overlapping matches.

Does this tool upload my pattern or sample text?

The matching is performed in a browser Web Worker. No server-based regex service is required. Avoid entering sensitive production data on websites unless you understand the entire site's data handling.

Does this regex tester guarantee that my pattern is secure?

No. A successful test only shows how the chosen pattern behaves on the supplied sample. It is not a formal ReDoS security audit or proof that a pattern will be efficient for every input.

Can I export the matches?

Yes. You can copy the match list or download a CSV containing match indexes, matched text, and capture-group details for the entries shown by the tool.

Learn more

Consult the MDN JavaScript regular expression guide for syntax and examples, and the MDN Worker termination reference for how a Web Worker can be stopped.