Dev Utilities
JavaScript regex tester
The regex tester runs a JavaScript regular expression against text you provide and reports each match with its zero-based start index and capture groups. Developers use it when porting a pattern from an IDE or library to the browser, checking an extraction rule against real log lines, or verifying that a form validation regex matches what it should. The "Flags" option defaults to g, and a /pattern/flags literal is accepted as well.
How to use RegEx Tester
- Open Regex Tester in the Toolbox101 app. It has three fields:
Regex pattern,FlagsandTest string. - Type a pattern into
Regex pattern, for example(\w+)@(\w+)\.(\w+), or paste a/pattern/flagsliteral to overrideFlags. - Leave
Flagsatg, or add letters such asiormfor case-insensitive or multiline matching. - Paste sample text into
Test stringand read theOutputbox:Match N @ index Ilines with the capture groups indented beneath and a blank line between matches. - Click
Copyto save the match report, or edit the pattern or flags and watch the output update.
Worked example
RegEx Tester returns the output below for this combination.
Input
(\w+)@(\w+)\.(\w+)Key
Mail dev@example.com or ops@test.io todayOutput
Match 1 @ index 5: dev@example.com
Group 1: dev
Group 2: example
Group 3: com
Match 2 @ index 24: ops@test.io
Group 1: ops
Group 2: test
Group 3: ioCheck it yourself: open RegEx Tester and enter the same input and key.
Frequently asked questions
Which regex flavor does this tester use?
JavaScript, the ECMAScript RegExp engine used by browsers and Node.js. The flags g, i, m, s, u and y behave as they do in that engine. Constructs JavaScript lacks, such as atomic groups or possessive quantifiers, are not supported, so a pattern that uses them shows an Invalid regular expression message instead of a result.
What does 'Match 1 @ index 8' mean?
The number after @ is the zero-based position in the Test String where the match starts, so index 8 means the match begins at the ninth character. The Group lines beneath show the captured substrings, numbered from 1 by the order of the opening parentheses in the pattern.
Why does the tester find no matches when my regex works elsewhere?
Flavor and flag differences are the usual cause. JavaScript treats ^ and $ as string boundaries unless the m flag is set, does not support some PCRE features, and only finds later matches when the g flag is present. Test the pattern in the same engine that runs it in production.
How is this different from the email and URL extractors?
The email and URL extractor tools apply their own fixed built-in patterns and return only the matched text lines. Regex Tester runs a pattern you wrote and shows each match with its index and capture groups, which is what you need while developing or debugging the very rules those extractors encode.
Use RegEx Tester now
Runs in your browser. Nothing you type is uploaded.