Developer Tools

Regex Tester

Write or paste a regular expression and watch every match light up in your test string as you type. The part most testers leave out is here too: an explanation panel that breaks your pattern down piece by piece and tells you, in plain English, what each bracket, quantifier and escape is actually doing. You also get a match inspector with capture groups, a search-and-replace preview, ready-made patterns and a cheat sheet. It runs on JavaScript's native RegExp engine, so what you see is exactly what your code will do.

Runs in your browserNo uploads, instantFree, no sign-up
Loading tool…
▸ Highlights
  • Plain-English explanation of every part of your pattern
  • Live highlighting as you type, with each match coloured
  • Clickable flag toggles that say what each flag does
  • Match inspector with positions, capture groups and named groups
  • Search-and-replace preview with $1 substitutions
  • Ready-made patterns: email, URL, IPv4, CNIC, PK mobile and more
  • Built-in cheat sheet for when you forget the syntax
  • Native JavaScript engine — identical to Node and the browser

How to use the Regex Tester

  1. 01

    Write or pick a pattern

    Type your regex, or start from one of the ready-made patterns.

  2. 02

    Set your flags

    Click g, i, m, s, u or y — each chip explains what it changes.

  3. 03

    Add test text

    Paste the string you want to match against and watch it highlight.

  4. 04

    Read the breakdown

    Open Explanation to see what your pattern does, token by token.

Frequently asked questions

What is a regular expression (regex)?+

A regular expression is a compact way of describing a search pattern for text. Instead of looking for one fixed string, you describe a shape — three digits, then a dash, then seven digits — and the engine finds everything that fits. Regex is used everywhere for searching, validating input and reformatting text.

How does the explanation panel work?+

It walks through your pattern from left to right and describes every construct it finds: character classes, quantifiers, anchors, groups, lookarounds, back-references and escapes. Nested groups are indented so you can see the structure, and each row shows the exact snippet it is describing. It is the fastest way to understand a regex you inherited from someone else.

What do the g, i, m, s, u and y flags mean?+

g (global) finds every match instead of stopping at the first. i ignores case. m (multiline) makes ^ and $ match at each line break rather than only at the ends of the string. s (dotAll) lets the dot match line breaks too. u enables full Unicode escapes like \p{L}. y (sticky) matches only at the current position instead of searching ahead.

Why is only one match highlighted?+

Because the g flag is off. Without it, JavaScript returns the first match and stops. Click the g chip to turn global matching on and every occurrence will be highlighted.

What is the difference between (abc) and (?:abc)?+

Both group the expression so a quantifier can apply to the whole thing. (abc) also captures — it remembers what it matched so you can reference it as $1 in a replacement or in the match inspector. (?:abc) groups without capturing, which keeps your group numbers clean and is slightly faster when you do not need the captured text.

How do I use capture groups in the replacement?+

In the Replace tab, use $1, $2 and so on for numbered capture groups, $<name> for named groups like (?<year>\d{4}), and $& for the entire match. The preview updates live so you can confirm the result before pasting it into your code.

Which regex flavour does this tester use?+

JavaScript's built-in RegExp engine, running in your own browser. The behaviour is identical to what you get in Node.js, React or any modern browser. Patterns from other flavours — PCRE, Python, Java — are usually close but not always identical, so a pattern copied from another language may need small adjustments.

Is my test data saved?+

No. Everything happens locally in your browser. Your patterns and test strings are never sent to a server, so it is safe to test against real log lines or customer data.

▸ Related tools
▸ BUILT BY ANWER SOLANGI

Need a custom tool or a mobile app? Let’s build it.

I’m a React Native & web developer in Karachi. These free tools are built with the same care I bring to client work.