Regex Tester
Test a JavaScript regular expression against sample text. Matches update as you type β nothing leaves your browser.
Enter a pattern to begin.
Test regular expressions live
A regular expression is a compact pattern for finding and extracting text β email addresses, order ids, dates, log fields and much more. Getting one right usually means a lot of trial and error, so this tester runs your pattern against sample text and highlights every match, its position and any capture groups as you type. It uses your browser's own JavaScript engine, so what works here works identically in Node or the browser console.
How to use it
- Type a pattern into the Pattern field (no surrounding slashes needed).
- Toggle Flags such as
g(global),i(case-insensitive) andm(multiline). - Paste or type text into the test string box and watch the matches update.
What the flags do
gβ find all matches, not just the first.iβ ignore case.mβ make^and$match line starts and ends.sβ let.match newlines.uβ full Unicode support;yβ sticky matching fromlastIndex.
A worked example
Load the sample and the email pattern:
[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}matches both ada@example.com and grace@example.org in the test text, each shown with its start index. Add capture groups with parentheses to pull out sub-parts of each match.
When you would reach for it
Writing a validation pattern, extracting fields from log lines, building a find-and-replace, or checking why a pattern in your code is not matching what you expect. To query structured JSON instead of free text, use the JSONPath tester; to scan a payload for secrets, try the sensitive data detector.
Privacy
Matching runs entirely in your browser and works offline once loaded. Your pattern and text are never uploaded or stored.
Frequently asked questions
Which regex engine is used?
Your browser's native JavaScript RegExp engine, so behaviour matches what you get in Node or the browser console.
Do I need to add slashes around my pattern?
No. Type just the pattern itself β the surrounding /.../ and the flags are shown for you and controlled by the flag buttons.
How do I see capture groups?
Wrap part of your pattern in parentheses. Each match then lists its numbered groups ($1, $2, β¦) beneath the matched text, so you can confirm you are extracting the right sub-parts.
Why does my pattern show an error?
An invalid pattern β an unbalanced bracket or an unsupported construct β makes the engine throw, and the message is shown in the results pane. Fix the syntax and matching resumes immediately.
Is my text uploaded?
No. Matching runs entirely in your browser β nothing is sent anywhere.