Home/Regex Tester

Regex Tester

Test and debug regular expressions with real-time matching, capture groups, and highlighted results.

//g

Enter a pattern to see results.

How to Test Regular Expressions

  1. 1Enter your regular expression pattern in the pattern input field at the top.
  2. 2Toggle regex flags (g, i, m, s) using the flag buttons to control matching behavior.
  3. 3Type or paste your test string in the text area below.
  4. 4Matches are highlighted in real time. View match details including index and capture groups in the results panel.
  5. 5Use the Common Patterns section for quick access to frequently used regex patterns like email, URL, or IP address.

Features

Real-time regex matching with instant highlighting
Support for global, case-insensitive, multiline, and dotAll flags
Capture group extraction with numbered and named groups
Match index positions for precise debugging
Built-in common regex patterns library for quick reference
Invalid pattern detection with clear error messages
100% client-side — your test data never leaves your browser
Free to use with no limitations or sign-up

Frequently Asked Questions

What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used in programming for string matching, validation, search-and-replace, and text parsing. For example, the regex \d+ matches one or more digits. Regex is supported in virtually all programming languages including JavaScript, Python, Java, and Go.
What do the regex flags (g, i, m, s) mean?
The 'g' (global) flag finds all matches instead of stopping at the first one. The 'i' (case-insensitive) flag ignores letter casing. The 'm' (multiline) flag makes ^ and $ match the start and end of each line. The 's' (dotAll) flag makes the dot (.) match newline characters as well.
What are capture groups?
Capture groups are portions of a regex pattern enclosed in parentheses (). They extract specific parts of a match. For example, in the pattern (\d{4})-(\d{2})-(\d{2}) matching '2024-01-15', group 1 captures '2024', group 2 captures '01', and group 3 captures '15'. Named groups use (?<name>...) syntax.
Why is my regex not matching?
Common issues include: forgetting the 'g' flag for multiple matches, not escaping special characters (like . or *), incorrect anchoring with ^ and $, or case sensitivity (try the 'i' flag). This tool highlights matches in real time, so you can iterate quickly to debug your pattern.
Is my test data safe?
Yes. All regex matching is performed entirely in your browser using JavaScript's native RegExp engine. No data is transmitted to any server. Your patterns and test strings remain completely private.

More Developer Tools