Regex Tester

An interactive regular-expression tester. Type a pattern and flags, paste your test text, and see all matches highlighted with their positions, plus every numbered and named capture group. Explains the flags and common tokens, and runs entirely in your browser so nothing is sent anywhere.

//g

2 matches

  • https://vibeengines.comat 6
    • 1https
    • 2vibeengines.com
    • schemehttps
    • hostvibeengines.com
  • http://example.orgat 34
    • 1http
    • 2example.org
    • schemehttp
    • hostexample.org

A regular expression is a tiny language for describing shapes of text. Instead of writing code to scan characters, you write a pattern — \d{3}-\d{4} for a phone number, ^\w+@\w+ for the start of an email — and the engine finds every substring that fits. The hard part is never the idea; it is seeing what your pattern actually matches versus what you meant.

That is what a live tester is for. You watch matches light up as you type, and the flags change the rules: g to find all of them, i to ignore case, m so ^ and $ hug each line, s so . also eats newlines. The moment a match appears where you didn’t expect one — or vanishes where you did — you learn more than any reference page teaches.

Capture groups are the payoff. Wrap part of the pattern in parentheses and the engine hands you just that piece: group 1, group 2, or a name via (?<year>\d{4}). That is how one pattern both validates a line and extracts its fields. The trap to respect is backtracking: nested quantifiers like (a+)+ can explode into exponential work on the wrong input, so keep patterns specific and anchored. This tool runs on your browser’s own JavaScript engine, so what you see here is exactly what your JS or Node code will do.

How it works

  • Uses the browser’s native ECMAScript regex engine.
  • Shows every match with its start index and length.
  • Lists numbered and named capture groups per match.
  • Toggle g / i / m / s flags and see results update live.

Frequently asked questions

Which regex flavor does this use?

It uses the JavaScript (ECMAScript) regular-expression engine built into your browser, so the syntax matches what you would use in JavaScript, TypeScript and Node. Most patterns are portable across languages, but some features differ — JavaScript supports named groups with (?<name>...), lookahead and (in modern engines) lookbehind, but does not support certain PCRE features like recursion or possessive quantifiers. If your target is Python, Go or PCRE, test there too for edge cases.

What do the flags g, i, m and s do?

g (global) finds all matches instead of stopping at the first. i (ignore-case) makes the pattern case-insensitive. m (multiline) makes ^ and $ match at line breaks, not just the start and end of the whole string. s (dotAll) lets the dot . match newline characters too. This tester lets you toggle each and re-runs instantly so you can see the effect.

What is a capture group?

Parentheses ( ) in a pattern create a capture group — a sub-part of the match you can extract separately. Groups are numbered left to right by their opening parenthesis; (?<name>...) also gives a group a name. This tool lists every group per match so you can see exactly what each parenthesis captured, which is how you pull fields out of a matched line. Use (?:...) for a non-capturing group when you need grouping without capturing.

How do I avoid catastrophic backtracking?

Patterns with nested quantifiers over overlapping alternatives — like (a+)+ or (.*)* — can make the engine explore an exponential number of paths on a non-matching input, hanging the page (a ReDoS). Prefer specific character classes over .*, avoid nested repetition, anchor your pattern, and use non-capturing or atomic constructs where possible. If a pattern is slow here on a modest input, it will be far worse on a server processing untrusted text.