iLoveDocsTools
All ToolsRegex Tester

Regex Tester

Test and debug regular expressions. Highlights all matches and shows captured groups.

?

FREE

Loading…

Go Pro ↑
//
Your files never leave your device. All processing happens locally in your browser — nothing is uploaded to our servers.Files are never stored on our servers · No tracking of your file contentsPrivacy Policy

What is Regex Tester?

Regex Tester is a free online tool for writing, testing, and debugging regular expressions against sample text in real time. Enter a pattern and see every match highlighted inline, with a live match count and each captured group's value broken out separately, so you can confirm exactly what your expression does before it goes into production code.

Regular expressions are compact and powerful, and that compactness is exactly what makes them so easy to get subtly wrong. A quantifier without a bound (like + instead of {1,4}) can match far more than intended; an unescaped special character (a literal . or ( that should have been \. or \() silently changes what the pattern matches; and greedy quantifiers by default consume as much text as possible, so .*" in a pattern meant to grab one quoted string can jump all the way to the last quote in the line instead of stopping at the first one. None of these mistakes throw an error — the regex still runs, it just matches the wrong thing, and that kind of silent failure is far more expensive to track down after the fact than a syntax error would be.

This tool exists for the iteration loop that precedes shipping a pattern: type a candidate expression, see immediately what it matches against representative input, adjust, repeat — all without re-running a script, restarting a server, or adding a temporary console.log to a codebase. It supports the full set of JavaScript regex flags: g (global, find every match instead of stopping at the first), i (case-insensitive matching), m (multiline, so ^ and $ anchor to line boundaries instead of only the start and end of the whole string), and s (dotAll, so . also matches newline characters, which it does not by default). Each flag can be toggled independently so you can see exactly how adding or removing one changes the match set.

Capturing groups — the parenthesized parts of a pattern — are extracted and listed separately for every match, which is often the fastest way to spot a group that is capturing the wrong span, an off-by-one in a nested group, or a group you meant to make non-capturing with (?:...) but forgot to.

Everything runs on the native JavaScript RegExp engine built into your browser — the same V8-based engine that runs in Node.js and Chrome — so a pattern that works here will behave identically once you copy it into actual application code. There is no server call and no data transmission, which matters because regex testing frequently involves pasting in real log lines, API responses, or database rows that you would rather not send to a third-party server.

How It Works

You supply a pattern and select which flags to apply (g, i, m, s). The tool constructs a native JavaScript RegExp object from those inputs and runs matchAll() against your test string, which returns every match along with its index and captured groups in one pass. The result renderer then walks through the test string and wraps each matched span in a highlight, leaving non-matching text untouched, so the highlighted output visually mirrors exactly what matchAll() found. Captured groups from every match are flattened into a single list showing which match and group index each value belongs to. If the pattern itself is invalid JavaScript regex syntax, the RegExp constructor throws, and that native error message is surfaced directly so you know precisely what to fix rather than guessing.

How to Use

  1. 1

    Enter your regex pattern

    Type or paste a regular expression into the pattern field, without the surrounding slashes — those are shown for you automatically.

  2. 2

    Select flags

    Toggle g, i, m, and/or s depending on whether you need global matching, case-insensitivity, multiline anchors, or newline-matching dots.

  3. 3

    Enter your test string

    Type or paste the actual text you want to match against — real sample data gives far more useful results than a made-up example.

  4. 4

    Run the test

    Click "Test Pattern" to see every match highlighted directly in the test string, plus the total match count.

  5. 5

    Inspect captured groups

    Scroll to the Captured Groups list to confirm each parenthesized part of your pattern is extracting exactly the substring you expect.

  6. 6

    Iterate on the pattern

    Adjust the pattern or flags and re-run the test until the highlighted matches and captured groups exactly match your intent, then copy the pattern into your code.

Who Uses This Tool

🔍

Pattern Validation

Test email, phone, or URL validation patterns against real input samples before using them in code.

📋

Log File Parsing

Develop and refine patterns for extracting specific fields from server log lines or error messages.

🔄

Find and Replace Logic

Verify a replacement pattern works correctly on sample text before applying it to a large file.

🧪

Form Input Validation

Build and test regex constraints for form fields like credit card numbers, ZIP codes, or usernames.

🛠️

Data Scraping Rules

Iterate on extraction patterns for web scraping scripts to ensure they capture the right tokens.

📚

Learning Regular Expressions

Use the match highlighting and group display to interactively learn how regex flags and syntax work.

Why Choose This Tool

Real-Time Match Highlighting

Matches are highlighted in yellow directly in the test string as you type, giving instant visual feedback.

Captured Group Display

All capturing groups are listed with their match index and value so you can verify extraction logic.

Flag Selection

Toggle g, i, m, and s flags individually so you can test each combination without editing the pattern.

Match Count Badge

Shows the total number of matches at a glance, making it easy to confirm your pattern is inclusive or exclusive enough.

Clear Error Reporting

Invalid regex patterns show a descriptive error message immediately rather than silently producing wrong results.

Privacy by Design

All pattern testing runs in the browser so sensitive log data and proprietary text never leaves your machine.

Key Benefits

  • Highlights every match inline against your actual test string
  • Live match count and per-match captured group values
  • Supports the full JavaScript flag set: g, i, m, and s
  • Native error messages surface exact regex syntax problems
  • 100% client-side — sensitive log lines and data never leave your browser
  • Uses the same V8 RegExp engine as Node.js and Chrome for accurate results
  • Cheatsheet panel for quick syntax reference without leaving the page
  • No installation, account, or command line required

Frequently Asked Questions

Also Known As

regex tester online freetest regular expression onlinejavascript regex tester browseronline regex matcher with highlightingregex pattern tester toolregular expression debugger onlinetest regex with capture groupslive regex tester no install

Trusted Worldwide

Free Online Document Tools for Everyone

iLoveDocsTools is used by students, professionals, and businesses across the United States, Canada, United Kingdom, Australia, India, and more than 100 other countries. All tools are browser-based and process files privately — your files never leave your device. Free to use, with Pro plans for unlimited access.

No Upload Required

All processing happens directly in your browser. Your documents are never sent to any server — complete privacy guaranteed for users in the USA, Canada, UK, and worldwide.

Free to Use — Pro Plans Available

Every tool on iLoveDocsTools is free to use. Need more? Upgrade to Pro for unlimited usage, priority access, and no daily limits. Trusted by students, freelancers, and teams across North America and Europe.

Works on Any Device

Whether you are on a Mac, Windows PC, iPhone, or Android in New York, Toronto, London, or Sydney — our tools work instantly in any modern browser.

Looking for free PDF tools in the USA? Free document converters in Canada? Online PDF editors in the UK or Australia? iLoveDocsTools offers 70+ free tools — merge PDF, split PDF, compress PDF, convert Word to PDF, Excel to PDF, JPG to PDF, and many more — all free, all instant, all private. No watermarks. No file size limits. Just free tools that work.