Command Palette

Search for a command to run...

RE

Regex Tester

Test regular expressions against sample text with live match highlighting, capture groups, and full flag support

What is a Regex Tester?

A Regex Tester lets you write a regular expression, run it against sample text, and see exactly what it matches in real time. Every match is highlighted in place, each capture group is listed with its value and position, and syntax errors in your pattern are reported with the engine's exact message - so you can debug a pattern in seconds instead of pasting it into your code and re-running your program.

Regular expressions are compact but unforgiving: a missing escape, a greedy quantifier, or a misunderstood character class can make a pattern match nothing, match too much, or throw an error. This tester uses the same JavaScript RegExp engine your browser and Node.js run, so the behavior you see here is the behavior you get in production code. Toggle the g, i, m, s, u, and y flags to see how each one changes the result.

Everything runs 100% in your browser. Your patterns and test data - which often include real log lines, user records, or proprietary formats - are never uploaded or stored. The tool works offline once loaded, so you can test expressions on sensitive data without it ever leaving your device.

The engine here is the browser's own, so behaviour matches what your JavaScript will do rather than approximating it. Two things trip people up. The global flag makes a regular expression stateful: it keeps a lastIndex between calls, so reusing the same object in a loop can skip matches or return null on a string that clearly matches. Creating the expression fresh, or resetting lastIndex, avoids it. The second is performance. Nested quantifiers over overlapping character sets, the (a+)+ shape, can take exponential time on input that fails to match, which is the mechanism behind regular expression denial of service. A pattern that is instant on your examples and hangs on a longer string has this problem, so test the failing cases as deliberately as the passing ones.

How to use the Regex Tester?

  1. Enter your pattern

    Type or paste a regular expression into the pattern field - write it without the surrounding slashes, just the expression itself. Click Load Sample to start from a working email-matching example.

  2. Choose flags

    Toggle flags like g (global - find all matches), i (case-insensitive), m (multiline anchors), and s (dot matches newlines) to control how the pattern is applied.

  3. Add test text

    Paste the text you want to search into the test area. Matches update live as you edit either the pattern or the text.

  4. Read the results

    See every match highlighted inline, review the numbered and named capture groups for each match, and copy the finished /pattern/flags expression when you are done.

Key Features

  • Live Match Highlighting

    Every match is highlighted directly in your test text as you type, with alternating colors so adjacent matches stay distinct

  • Capture Group Breakdown

    Numbered and named capture groups are listed per match with their captured values, so you can verify what each part of the pattern extracts

  • Full Flag Support

    Toggle all six JavaScript flags - global, ignore-case, multiline, dotAll, unicode, and sticky - and see the effect immediately

  • Accurate Error Messages

    Invalid patterns are caught and reported with the JavaScript engine's exact error, pointing you straight at the syntax problem

Frequently Asked Questions

Enter your pattern in the pattern field (without slashes), choose your flags, and paste sample text into the test area. Matches are highlighted instantly and capture groups are listed for each match. Everything runs in your browser - nothing is uploaded.

Comments

0 comments

0/2000 characters

No comments yet. Be the first to share your thoughts!

regex testerregex tester onlineregular expression testertest regexregex matchregex checkerjavascript regex testerregex validatorregex capture groups