Free Regex Tester & Debugger Online

This free Regex Tester lets you write a regular expression and see matches highlighted as you type. Toggle flags, inspect capture groups and named groups, and preview a find-and-replace result without leaving the page. It uses your browser's own JavaScript regex engine, so what you see is how your code will behave.

๐Ÿ’ป Developer Toolsโœ“ 100% freeโœ“ No sign-upโœ“ Private: runs in your browser
Flags

Highlighted matches

Match details

#MatchIndexGroups

Replace

Quick cheat sheet
  • . any character   \d digit   \w word character   \s whitespace
  • ^ start   $ end   \b word boundary
  • * zero or more   + one or more   ? optional   {n,m} range
  • [abc] set   [^abc] not in set   (a|b) either
  • (...) capture group   (?:...) non-capturing   (?<name>...) named group
  • (?=...) lookahead   (?<=...) lookbehind

What Is a Regex Tester?

A regular expression, usually shortened to regex, is a compact pattern for finding and manipulating text. With a few symbols you can match email addresses, phone numbers, dates, URLs or any other structured text. A Regex Tester is a live workbench for these patterns: you type the expression, paste some sample text and see immediately what it matches.

This Regex Tester uses the JavaScript regular expression engine built into your browser, so results match what you will get in web pages and Node.js. Matches are highlighted in the text, a table lists every match with its position and each capture group, including named groups, and a replace box previews the output of a find-and-replace using $1-style references.

Flags are one click away: global to find all matches, case-insensitive, multiline, dot-all, unicode and sticky. Invalid patterns produce a readable error instead of a blank screen.

How to Use the Regex Tester

  1. Type your pattern into the expression box without the surrounding slashes.
  2. Tick the flags you need. Global is on by default so every match is found.
  3. Paste or type the text you want to search in the test string box.
  4. Look at the highlighted matches and the match details table to check positions and capture groups.
  5. Refine the pattern until it matches exactly what you want and nothing more.
  6. Enter a replacement string to preview a find-and-replace, then copy the working pattern into your code.

Key Features of Our Regex Tester

  • Live match highlighting as you type
  • Support for g, i, m, s, u and y flags
  • Table of matches with index and capture groups
  • Named group support
  • Replace preview with $1 and $<name> references
  • Readable error messages for invalid patterns
  • Safe handling of empty matches and a 1,000 match cap
  • Built-in cheat sheet and private, in-browser processing

Benefits of Using an Online Regex Tester

Regular expressions are powerful but easy to get subtly wrong. Seeing matches highlighted instantly turns guesswork into a quick feedback loop, so you catch greedy patterns, missing anchors and escaping mistakes before they reach your code.

Because the tester uses the same engine as your browser, you avoid surprises from differences between regex flavors. Capture group details make it easy to confirm what a pattern extracts, which is half the battle in data cleaning and validation.

Your privacy comes first. The Regex Tester runs entirely in your web browser. Nothing you enter is sent to our servers, which keeps your data private and makes results appear instantly. See our Privacy Policy for details.

Common Use Cases for the Regex Tester

  • Validating form input such as emails, postcodes and phone numbers
  • Extracting IDs, dates and prices from logs or documents
  • Cleaning and reformatting text with find and replace
  • Writing search rules for editors and scripts
  • Debugging patterns copied from tutorials or Stack Overflow
  • Learning how quantifiers, groups and lookaheads work
  • Testing URL routing patterns
  • Preparing patterns for JavaScript, TypeScript and Node.js projects

Tips for Getting the Best Results

  • Start simple and add complexity step by step, checking the highlights after each change.
  • Use anchors such as ^ and $ with the multiline flag when you want to match whole lines.
  • Prefer specific classes like \d and [A-Za-z] over a greedy dot when possible.
  • Escape special characters such as . and ( with a backslash when you mean them literally.
  • Be careful with nested quantifiers like (a+)+. They can cause extremely slow matching on some inputs.
  • Remember that other languages may support different features, so double check lookbehind and named groups there.

Regex Tester FAQ

What is a regex tester?

It is a tool that lets you try a regular expression against sample text and see what it matches in real time, which makes writing and debugging patterns much faster.

Which regex flavor does this Regex Tester use?

It uses the JavaScript (ECMAScript) engine in your browser. Patterns that work here will work in JavaScript and TypeScript, though other languages can differ in small ways.

What do the flags mean?

g finds all matches, i ignores case, m makes ^ and $ work per line, s lets the dot match line breaks, u enables full Unicode matching and y matches only at the current position.

Why does my pattern match an empty string?

Patterns that can match nothing, such as a*, match empty strings between characters. The tool advances past them safely and labels them in the table.

Why is my page slow with some patterns?

Certain patterns with nested repeats can cause catastrophic backtracking. Simplify the expression or make it more specific.

Is my text uploaded?

No. Matching happens locally in your browser and nothing you type is sent anywhere.