Regex Tester - Test Regular Expressions with Live Match Highlighting

Developer Tools Free to use

Test a regular expression before it reaches your code

This regex tester runs your pattern against sample text and highlights every match, so you can see at once whether a regular expression does what you meant. Each match is listed with its position and its capture groups.

Debug regex with groups and a replace preview

Named groups, flags and a replacement string are supported, which makes it easy to test regex online and check the final text before it goes into your code. The tool uses the JavaScript engine in your browser, so the behaviour matches what you get in a web page or in Node. Other languages differ in small ways, for example in how they treat lookbehind or named groups, so test again in your own environment before you rely on a pattern.

How to use Regex Tester

  1. Type the pattern without slashes, for example (\d+)-(\w+).
  2. Tick the flags you need, such as g, i or m.
  3. Paste the test text, solve the security check and press Test.
  4. Read the highlighted text and the match table, then try a replacement.

About Regex Tester

The tool builds a RegExp object with your pattern and flags and loops over the matches. Empty matches move the search forward by one character so the loop always ends, and at most 1000 matches are shown. The replace preview uses String.replace, so $1, $& and $<name> work as in JavaScript.

Purpose of Regex Tester Tool

Use it to build a validation pattern, pull values out of logs, check a search-and-replace before running it on a file, or learn how groups, lazy quantifiers and lookaheads behave.

Limitations of Regex Tester

  • It uses the JavaScript engine. PCRE, Python or .NET features such as possessive quantifiers or inline modes may not work.
  • A pattern with heavy backtracking can freeze the page. Keep test text short while you tune such a pattern.
  • Only the first 1000 matches are shown, and text over 200000 characters is refused.
  • Lookbehind and the s, u, v and d flags depend on your browser version.

Privacy and data

Regex Tester runs entirely in your browser. What you type or select is processed on your own device and is never sent to or stored on our server. See our Privacy Policy for details.

Frequently asked questions

Why does my regex match nothing?

Check the flags first. Without i, matching is case sensitive, and without m, ^ and $ only match the start and end of the whole text. Also remember to escape characters such as . ( ) and ?.

What does the g flag do?

The g flag finds all matches. Without it, only the first match is returned.

Is the regex tester free and safe to use?

Yes. The regex tester is free to use and runs in your browser, so your pattern and text is not uploaded, stored or logged.

How do I test a regular expression online?

Type your pattern, choose the flags and paste your test text. Every match is highlighted and the capture groups are listed.

Which regex flavour does the tester use?

It uses JavaScript regular expressions. Basic patterns work the same in most languages, but some features, such as lookbehind and named groups, differ between engines.

Rate Regex Tester

No ratings yet. Be the first to rate this tool.

Your rating

Report a bug or give feedback

Tell us about Regex Tester. The subject of your message will name this tool.