Regex Tester — Debug Regular Expressions Live

Write a regular expression and see every match highlighted in real time. This free online regex tester shows a capture group table, lets you run find-and-replace with group references, and includes a library of 10 ready-to-use patterns — all running in your browser's JavaScript engine. Regex patterns are commonly used to validate fields in CSV data or sanitize inputs before passing them to SQL queries.

0 matches

No capture groups — enter a regex with parentheses like (group)

Common Patterns

Regex Tester — Learn Regular Expressions Interactively

Regular expressions (regex) are a concise language for pattern matching inside text, built into every major programming language and text editor. This online regex tester runs patterns directly in your browser's JavaScript engine — no server round trips, instant feedback on every keystroke.

How to Use the Regex Tester

  1. Type your regular expression in the pattern field at the top.
  2. Toggle flags (g, m, i, s, u) to control global matching, case sensitivity, and multiline mode.
  3. Type or paste your test string in the text area — matches highlight in real time.
  4. Check the match count badge and review the Capture Groups table for group-level detail.
  5. Switch to the Find & Replace tab, enter a replacement string (use $1, $2… for group references), and copy the result.
  6. Click a pattern in the Common Patterns sidebar to load it instantly — Email, URL, IPv4, Phone, Date, Hex color, and more.

Key Features

  • Live match highlighting with colored overlay on the test text
  • Match count badge showing total matches found
  • Flag toggle buttons: g (global), m (multiline), i (case-insensitive), s (dot-all), u (Unicode)
  • Capture groups table showing each match's full text and individual group values
  • Find & Replace with $1/$2 group references and live result preview
  • Copy Matches — copies all matched strings to clipboard
  • 10-pattern library: Email, URL, IPv4, US Phone, Date, Hex color, HTML tag, Credit card, ZIP code, Whitespace
  • Real-time error display with red border on invalid regex syntax

Use Cases

JavaScript Regex Tester for Web Developers

JavaScript's RegExp engine powers this tester, making it the ideal tool for validating regex patterns before embedding them in front-end or Node.js code. Test email validation patterns, URL parsers, or form input constraints against real data before shipping.

Online Find and Replace with Regex

The Find & Replace tab lets you write a replacement string using $1, $2 group references. This is the fastest way to test and preview complex string transformations — from reformatting dates (YYYY-MM-DD to DD/MM/YYYY) to stripping HTML tags — before using them in a script. After transforming text with a regex replacement, the word counter is useful for checking the output's length and word count.

Regex Tester with Capture Group Analysis

When your pattern contains parentheses, the Capture Groups tab displays a table of every match broken down by group. This is invaluable for debugging complex patterns with multiple capture groups, named groups, or nested structures.

Essential Regex Syntax Reference

  • . — Any character except newline (use s flag for newlines)
  • * / + / ? — 0 or more / 1 or more / 0 or 1 occurrences
  • [abc] / [^abc] — Character class / negated class
  • \d / \w / \s — Digit / word character / whitespace
  • ^ / $ — Start / end of string (or line with m flag)
  • (group) — Capture group — reference with $1, $2 in replacements
  • (?:group) — Non-capturing group
  • a{3} / a{2,5} — Exactly 3 / between 2 and 5 occurrences

FAQ's

This tester uses JavaScript's built-in RegExp engine (ECMAScript regex). It supports lookaheads, named capture groups, Unicode mode, and dot-all mode. It does not support PCRE-specific features like \K (keep text) or variable-length lookbehinds in older browsers.
Parentheses create capture groups: (pattern). Each is numbered left to right starting at 1. In the Capture Groups tab you see every match broken down by group. In Find & Replace, reference groups with $1, $2, etc. in the replacement string.
Quantifiers like .* are greedy by default — they match as much as possible. Add a ? to make them lazy (.*?), or use more specific character classes. Anchors (^ and $) restrict matching to the start or end of a line, and word boundaries (\b) prevent partial-word matches.
Toggle the i flag button above the test string. With the i flag active, your pattern matches both uppercase and lowercase letters — so [a-z] also matches A-Z, and "hello" matches "Hello", "HELLO", etc.
Switch to the Find & Replace tab and enter your replacement string. Use $1, $2 to insert the text captured by each group. For example, if your pattern is (\d{4})-(\d{2})-(\d{2}), a replacement of $3/$2/$1 converts YYYY-MM-DD to DD/MM/YYYY. The result updates live as you type.
The g (global) flag tells the engine to find all matches in the text rather than stopping after the first. The tester always counts all matches, but the g flag also affects the Find & Replace tab — without it, only the first occurrence is replaced.
Yes. Click the Email pattern in the Common Patterns sidebar to load a practical email regex instantly. Paste your list of addresses in the test area to see which ones match and which do not. You can then tweak the pattern to fit your exact validation requirements.

Related Tools

The Toolaroid Regex Tester is a free, browser-based tool for writing, testing, and debugging JavaScript regular expressions. Type a pattern and see every match highlighted in the test string in real time. The capture groups table breaks down each match by group so you can verify complex patterns at a glance, while the Find & Replace tab lets you preview string transformations with $1/$2 group references before using them in code. A built-in pattern library covers the most common use cases — email, URL, IPv4, phone, date, and more. No server, no account, and no data leaves your browser.