DevOps Live Data stays in your browser

Regex Tester

Test regular expressions live against any text. Highlights all matches, shows capture groups, counts results, and supports find-and-replace. Nothing sent.

/ /
Quick reference
. Any character (except newline)
\d Digit [0-9]
\w Word char [a-zA-Z0-9_]
\s Whitespace
\b Word boundary
^ Start of string/line
$ End of string/line
* 0 or more
+ 1 or more
? 0 or 1 (optional)
{n,m} Between n and m times
[abc] Character class
[^abc] Negated class
(abc) Capture group
(?:abc) Non-capture group
a|b Alternation (a or b)
(?=abc) Lookahead
(?!abc) Negative lookahead

Disclaimer: Free tool provided “as is” by MonitorGiant. No warranty or liability for any data loss, security issues, or infrastructure problems arising from use of this tool. Results are for informational purposes only. · A Free Tool by MonitorGiant

What is Regex Tester?

The Regex Tester lets you write and test regular expressions against any sample text in real time. All matches are highlighted directly in the text as you type, capture groups are shown in a structured table, and a match count is updated live. The tool also includes a find-and-replace mode so you can preview substitutions before applying them in your code. Everything runs in your browser using JavaScript's native RegExp engine.

How to use this tool

  1. 1 Type your regular expression into the pattern field — matches highlight in the text area immediately.
  2. 2 Set your flags using the checkboxes: 'g' for global (find all matches), 'i' for case-insensitive, 'm' for multiline.
  3. 3 Paste or type your test string into the large text area.
  4. 4 Check the 'Groups' table below to see each capture group's value for every match.
  5. 5 Switch to 'Replace' mode, enter a replacement string (use $1, $2 for group references), and preview the result.

When would you use this?

  • Validating the format of user input — email addresses, phone numbers, postal codes, or custom ID formats — before writing the regex into your application code.
  • Extracting structured data from log files or CSV exports by matching patterns and using capture groups to isolate specific fields.
  • Testing a find-and-replace pattern before running a global substitution across a large codebase or document.

Related tools

How Regex Tester works

The Regex Tester runs JavaScript's built-in RegExp engine live in your browser — the same engine used in Node.js, Chrome, and most modern runtimes. Updates are instant as you type.

  1. 1

    Enter your regular expression

    Type your pattern between the forward-slash delimiters. Enable flags with the toggle buttons: g (global — find all matches), i (case-insensitive), m (multiline — ^ and $ match line starts/ends), s (dotAll — dot matches newlines).

  2. 2

    Paste your test string

    Type or paste any text into the test string area. Matches are highlighted in real time as you type — no button needed. The match count updates in the label.

  3. 3

    Inspect capture groups

    If your pattern contains parenthesised groups, each match's captured groups are shown below the test string — useful for validating named sub-patterns in email addresses, dates, or URLs.

  4. 4

    Switch to Replace mode

    Replace mode applies String.replace() with your regex and replacement string. Use $1, $2 etc. to reference capture groups. The result appears in a read-only output panel you can copy.

Your patterns and test strings are processed entirely in your browser using the native JavaScript RegExp API. Nothing is sent to MonitorGiant or any third party.

Trying to test a regex online and see all matches in real time? JavaScript regex supports global (g), case-insensitive (i), multiline (m), and dotAll (s) flags. This tester highlights every match as you type, shows numbered and named capture groups, and counts total matches — all using the same V8 RegExp engine that powers Node.js and Chrome. Useful for validating email addresses, parsing log lines, extracting query parameters, or writing patterns for URL routing.

Frequently asked questions — Regex Tester

How do I test a regular expression online?

Enter your regex pattern in the Pattern field and your test string in the Text area. Matches are highlighted in real time as you type. The match count and each matched substring are shown below the pattern. Switch to Replace mode to test substitutions, using $1, $2 for capture group references.

What do the regex flags g, i, m, and s mean?

g (global) finds all matches rather than stopping at the first one. i (case-insensitive) makes the pattern match regardless of letter case. m (multiline) makes ^ and $ match the start and end of each line rather than the whole string. s (dotAll) makes the . character match newlines too — without s, . skips \n characters. You can combine flags: /pattern/gim.

How do I match text across multiple lines?

Enable both the m (multiline) flag so ^ and $ anchor to each line, and the s (dotAll) flag so . matches newlines. For example, /^start.*end$/ms matches "start" and "end" even if there are newline characters between them. Without the s flag, .* stops at the first newline.

How do I use capture groups and backreferences?

Wrap part of your pattern in parentheses to create a capture group: (\w+)@(\w+\.\w+) creates two groups. In the tool's match panel, you'll see each group's captured value listed. In replace mode, use $1 to insert the first group's match, $2 for the second, and so on. Named groups use (?<name>pattern) syntax and are referenced as $<name> in replacements.

How do I match an email address with a regex?

A practical email regex for most use cases is: /^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/. This matches the local part (before @), the domain, and a TLD of two or more characters. Note that a truly RFC 5322-compliant email regex is extremely complex — for production use, complement regex validation with a confirmation email or an email validation API.

Comments & Feedback

Found a bug? Have a suggestion? We'd love to hear from you.

0 / 2000

Related Tools

From the makers of this tool

Need deeper observability?

MonitorGiant tracks real-time AI performance, infrastructure health, and system reliability — far beyond what free utilities can show.

Explore MonitorGiant