100% Private — All processing happens locally in your browser.

Regex Tester

Test regular expressions with real-time match highlighting and capture group extraction. Free and private.

FreeNo SignupNo UploadsNo Tracking

Regex Tester

Test regular expressions with real-time match highlighting and capture group extraction.

Pattern
//g
Test String
Embed code
<iframe src="https://devally.dev/embed/regex-tester" width="100%" height="600" frameborder="0" title="Regex Tester - devcraft"></iframe>
<p style="font-size:12px;text-align:center;margin-top:4px;">
  <a href="https://devally.dev/tools/regex-tester" target="_blank" rel="noopener">Powered by devcraft</a>
</p>
Attribution preview

Powered by devcraft

How to Use Regex Tester

  1. 1

    Enter a regex pattern

    Type your regular expression in the pattern field. You can also pick a common pattern from the dropdown.

  2. 2

    Set flags

    Toggle the flags you need: g (global), i (case insensitive), m (multiline), or s (dotall).

  3. 3

    Type your test string

    Enter the text you want to match against. Matches are highlighted in real time as you type.

  4. 4

    Review results

    See all matches highlighted in yellow, with detailed match info and capture groups listed below.

Frequently Asked Questions

This tool uses JavaScript's native RegExp engine, which supports most common regex features including lookahead, lookbehind, named capture groups, Unicode property escapes, and more.

g = global (find all matches), i = case insensitive, m = multiline (^ and $ match line boundaries), s = dotall (. matches newlines including \n).

JavaScript regex syntax is largely compatible with most languages, but there are subtle differences. This tool uses the JavaScript regex engine specifically. Features like possessive quantifiers or atomic groups are not available.

Yes. All regex matching happens in your browser. No data or patterns are sent to any server.

Capture groups are portions of the regex enclosed in parentheses (). They capture the matched substring so it can be referenced later. This tool displays all capture groups for each match.

Related Tools

Regular Expressions: Powerful but Dangerous

Regular expressions (regex) describe search patterns using a compact syntax. A pattern like \b\d3-\d4\b matches phone number fragments (e.g., 555-1234) in any text. Regex power comes from quantifiers (*, +, ?), character classes (\d, \w, \s), anchors (^, $), and groups — together, these can match virtually any text pattern. The tradeoff is readability: even experienced developers struggle to parse complex regex, which is why testing tools are essential.

Capture Groups and Backreferences

Parentheses in regex serve two purposes: grouping (for applying quantifiers to a sequence) and capturing (for extracting matched substrings). In the pattern (\d4)-(\d2)-(\d2), group 1 captures the year, group 2 the month, group 3 the day. Named groups ((?<year>\d4)) make code more readable. Non-capturing groups ((?:...)) group without capturing, which is slightly more performant when you do not need the matched substring.

ReDoS: When Regex Becomes a Security Risk

Catastrophic backtracking occurs when a regex engine explores exponentially many paths on certain inputs. The pattern (a+)+$ applied to "aaaaaaaaaaaaaaaaab" can take seconds or minutes because the engine tries every possible way to divide the a's between the inner and outer groups before failing. This is exploitable as a ReDoS (Regular Expression Denial of Service) attack. Avoid nested quantifiers on overlapping patterns, and use tools that detect vulnerable patterns before deploying regex to production.