Skip to content

Regex Tester - Test Regular Expressions Online

//

About the Regex Tester

Regular expressions are one of the most powerful text-processing tools in a developer's toolkit, but they can be tricky to get right on the first attempt. A misplaced quantifier or forgotten escape character can change the meaning of an entire pattern. This regex tester lets you write a pattern, provide a test string, and see every match highlighted in real time so you can iterate quickly without switching between your editor and a terminal.

The tool uses JavaScript's native RegExp engine, so results match exactly what you get in browser-based and Node.js applications. It displays the full match, its index position, and every capture group for each result, giving you the details you need to build extraction and validation logic with confidence.

How to Use the Regex Tester

Type your pattern into the regex field between the two forward slashes. Set flags using the text input or toggle the checkboxes for global, case-insensitive, and multiline modes. Paste or type your test string in the textarea below. The results panel updates instantly as you type, showing highlighted matches in the test string and a detailed breakdown of each match with its capture groups.

Features

  • Real-time matching. Results update on every keystroke in both the pattern and test string fields.
  • Match highlighting. Matches are highlighted directly in the test string so you can see exactly what your pattern captures.
  • Capture group display. Each match lists its numbered capture groups, making it easy to verify extraction logic.
  • Flag toggles. Quickly enable or disable global, case-insensitive, and multiline flags with checkboxes or type custom flags directly.
  • Clear error messages. Invalid patterns display the exact error from the JavaScript engine so you know what to fix.

Common Use Cases

Developers reach for regex testing when building form validation rules (email, phone, postal code), parsing log files for specific patterns, writing search-and-replace operations, extracting data from structured text like CSV or HTML, and building route matchers in web frameworks. Having a dedicated tester with live feedback makes each of these tasks faster and less error-prone than trial and error in source code.

Frequently Asked Questions

What regex flavour does this tester use?
This tester uses JavaScript's built-in RegExp engine, which follows the ECMAScript specification. It supports features like character classes, quantifiers, lookaheads, lookbehinds (in modern browsers), named capture groups, and Unicode property escapes. If you are writing regex for a JavaScript or TypeScript project, what you test here will work exactly the same in your code.
What do the g, i, and m flags do?
The 'g' (global) flag finds all matches in the string instead of stopping after the first. The 'i' (case-insensitive) flag makes the pattern ignore uppercase and lowercase differences. The 'm' (multiline) flag changes the behaviour of ^ and $ so they match the start and end of each line, not just the start and end of the entire string. You can combine them freely.
Why does my regex cause an error?
Common causes include unbalanced parentheses, unescaped special characters like ( or [ without a matching closing bracket, invalid quantifiers like {a}, or unsupported syntax in your browser's regex engine. The error message shown below the pattern input tells you exactly what the JavaScript engine rejected.
How do capture groups work?
Capture groups are created by wrapping part of your pattern in parentheses. For example, (\d{4})-(\d{2})-(\d{2}) matching '2024-01-15' produces three groups: '2024', '01', and '15'. Each match in the results panel lists its capture groups with their group number ($1, $2, etc.) so you can verify extraction logic before writing code.
What are some common regex patterns?
Email addresses: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. URLs: https?://[^\s]+. IP addresses: \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b. Dates in YYYY-MM-DD format: \d{4}-\d{2}-\d{2}. Phone numbers (US): \(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}. Paste any of these into the pattern field to try them out.