Regex Tester & Debugger

Free online regex tester. Test regular expressions in real time with match highlighting, capture groups, and flag toggles — all in your browser.

Your data never leaves your browser
//g
g Find all matches
Contact us at hello@example.com or support@devtoolhub.net for help.
#1"hello@example.com"index 14
$1: "hello"$2: "example.com"
#2"support@devtoolhub.net"index 35
$1: "support"$2: "devtoolhub.net"

How to Use

  1. 1

    Enter a regex pattern

    Type your regular expression between the / delimiters. For example, (\w+)@(\w+\.\w+) to match email addresses.

  2. 2

    Toggle flags

    Click flag buttons to enable global (g), case-insensitive (i), multiline (m), or dotAll (s) modes.

  3. 3

    Enter test text

    Paste or type the text you want to test your regex against.

  4. 4

    Review matches

    Matches are highlighted in yellow. The details section shows each match, its position, and any captured groups.

What is Regex Tester & Debugger?

A regex tester is an online tool for writing, testing, and debugging regular expressions. You enter a pattern, paste sample text, and instantly see which substrings match, where each match starts and ends, and what each capture group extracts. This immediate feedback loop turns regex from an exercise in trial-and-error into a fast, visual workflow.

Regular expressions (regex) are a compact pattern-matching language built into virtually every programming language, text editor, and command-line tool. Developers use them for input validation (emails, phone numbers, URLs), search and replace, log parsing, data extraction, and input sanitization. The hard part is not writing a regex — it is verifying that it matches what you expect and rejects what you don't.

This regex tester uses JavaScript's native `RegExp` engine and supports all the flags you need for everyday use: global matching (`g`), case-insensitive (`i`), multiline (`m`), and dotAll (`s`). Matches are highlighted as you type. Capture groups are extracted with their positions. Common errors (unescaped special characters, missing flags) are easy to diagnose. Everything runs client-side — your patterns and test data never leave your browser.

For a quick syntax reference while you build patterns, open our [Regex Cheat Sheet](/cheat-sheets/regex/). For a step-by-step tutorial with annotated examples, see the guide on [Regular Expressions Cheat Sheet with Examples](/blog/regex-cheat-sheet-with-examples/). Related text-processing tools include the [Slug Generator](/tools/slug-generator/), [Diff Checker](/tools/diff-checker/), and [Line Sorter](/tools/line-sorter/).

FAQ

Which regex engine does this use?
This tool uses JavaScript's built-in RegExp engine, which supports most common regex features including lookahead, lookbehind (in modern browsers), character classes, quantifiers, alternation, and named capture groups.
Why doesn't my regex match anything?
Common issues: forgetting to escape special characters (use \. instead of . for a literal dot), not enabling the global flag for multiple matches, or case sensitivity (enable the i flag). Also check that anchors (^ and $) match what you expect — by default, they only match the start/end of the entire string, not each line.
What do the capture group numbers mean?
Capture groups are created by parentheses in your pattern. $1 is the first group, $2 the second, and so on. In (\w+)@(\w+), $1 captures the username and $2 captures the domain.
Is this compatible with Python/Java/PHP regex?
JavaScript regex is largely compatible with other engines for common patterns. However, some features differ — for example, JavaScript doesn't support possessive quantifiers (++) or atomic groups. Python uses (?P<name>) for named groups while JavaScript uses (?<name>). Always test in your target language for complex patterns.
How do I test a regex against multiple lines?
Enable the multiline flag (m) so that ^ and $ match the start and end of each line, not just the entire string. For matching newlines with the dot (.), enable the dotAll flag (s) — without it, the dot does not match newline characters.
Can I share or save my regex patterns?
All patterns and test data are kept in your browser. The tool does not save or share data. To share a pattern, copy it and paste it into a message or note. Many developers keep a personal collection of useful patterns in a text file or a snippet manager.

Related Articles

Related Tools