Developer Free · no signup

Regex Tester

Test regular expressions against text with match highlighting, groups, and flags support.

Paste your text, type a regular expression, and the Regex Tester highlights every match live while listing each captured group, its index, and the exact character offset. It supports the common flags — g (global), i (case-insensitive), m (multiline), s (dotAll), and u (unicode) — and updates instantly as you edit the pattern, making it the fastest way to confirm a regex matches what you expect before you drop it into code.

Updated Krawly Editorial TeamIn-house engineers, writers & reviewers

Explore More Free Tools

Discover 150+ free tools for web scraping, SEO analysis, OSINT, and more. 30 free uses every day — no signup required.

150+ Free Tools No Signup Required JSON / CSV / Excel 30 Uses / Day
Quick answer

Paste your text, type a regular expression, and the Regex Tester highlights every match live while listing each captured group, its index, and the exact character offset. It supports the common flags — g (global), i (case-insensitive), m (multiline), s (dotAll), and u (unicode) — and updates instantly as you edit the pattern, making it the fastest way to confirm a regex matches what you expect before you drop it into code.

What is Regex Tester?

The Regex Tester is a free online tool that lets you build and debug regular expressions against your own sample text and see every match highlighted in real time. It shows capture groups, match positions, and named groups as you type, so you never have to guess whether your pattern actually works. Everything runs in your browser, so your test data never leaves your machine.

How to use Regex Tester

  1. 1

    Paste your test text

    Drop the sample string, log excerpt, or document you want to match against into the test area. Include both cases that should match and cases that shouldn't so you can verify the pattern rejects false positives.

  2. 2

    Type your regular expression

    Enter the pattern in the regex field without the surrounding slashes. Start simple and add anchors, character classes, and quantifiers step by step, watching the highlights change as you go.

  3. 3

    Set the flags you need

    Toggle g to find all matches instead of just the first, i to ignore case, m so ^ and $ match line boundaries, and s so the dot matches newlines. The wrong flag is the most common reason a pattern seems broken.

  4. 4

    Inspect groups and matches

    Review the highlighted matches and the group breakdown to confirm each capture pulls the exact substring you intended. Adjust the pattern until only the intended text is captured, then copy it into your code.

Try it when you need to…

  • You wrote a validation regex but it wrongly rejects valid emails and you need to see exactly which character fails
  • A scraper's extraction pattern grabs too much text and you need to see where the greedy quantifier overreaches
  • You want a working case-insensitive multiline pattern but aren't sure which flag combination produces it

Use cases

  • Validate that an email, phone, or URL pattern accepts real inputs and rejects malformed ones before shipping form validation
  • Debug a pattern that works in one language but fails in another by checking JavaScript-flavored behavior first
  • Build capture groups to pull dates, IDs, or price fields out of log lines and scraped text
  • Craft find-and-replace patterns for bulk edits in your code editor and confirm the groups line up
  • Learn regex interactively by tweaking a pattern and watching which characters light up as matches

Key features

Live match highlighting that updates on every keystroke, with no run button needed
Full support for g, i, m, s, and u flags toggled individually
Numbered and named capture group breakdown showing each group's value and position
Match index and character-offset reporting for every hit in the text
Runs entirely client-side so sensitive test data is never uploaded

Tips & best practices

This tester uses the JavaScript regex engine. Features like lookbehind, possessive quantifiers, and recursion behave differently in PCRE, Python's re, or Go's RE2 — verify in your target language before deploying.

Watch out for catastrophic backtracking: nested quantifiers like (a+)+ against a long non-matching string can hang an engine. If a pattern feels slow, simplify the quantifiers or add anchors.

Remember that . does not match newlines unless you enable the s (dotAll) flag, and ^ / $ only match line starts and ends when the m flag is on.

Escape special characters — . * + ? ( ) [ ] { } ^ $ | \ — with a backslash when you want them treated literally, or use \. to match an actual dot.

Frequently asked questions

It uses the JavaScript (ECMAScript) regular expression engine that runs in your browser. Most core syntax is universal, but advanced constructs such as lookbehind and Unicode property escapes may match differently in PCRE, Python, Java, or Go, so confirm edge cases in your production language.

A greedy quantifier like .* matches as much text as possible and then backtracks, while a lazy quantifier like .*? matches as little as possible. Use the lazy form when you want to stop at the first delimiter, such as pulling the contents of a single HTML tag instead of everything up to the last closing tag.

Enable the m flag so ^ and $ anchor to the start and end of each line rather than the whole string, and enable the s (dotAll) flag if you also need the dot to match newline characters. These two flags control different behaviors, so you often need both for multiline text.

Without the g (global) flag, the engine stops after the first match. Turn on g to iterate over every occurrence in the text; the tester will then highlight and list all of them.

Parentheses create numbered capture groups that let you extract sub-parts of a match, referenced as $1, $2, and so on. Named groups use the (?<name>...) syntax so you can reference them by a readable label like (?<year>\d{4}), which makes complex patterns far easier to maintain.

No. The matching runs entirely in your browser using the native regex engine, so the text and pattern you enter never leave your device. This makes it safe to test against logs or data containing sensitive information.

Escape it with a backslash — write \. for a literal period or \+ for a literal plus. Inside a character class, most metacharacters lose their special meaning, so [.+] matches a literal dot or plus without escaping.