Skip to content
NewKitApp

Search tools

Jump to any tool by name

Regex Tester

Test a regular expression against a string with live highlighted matches.

//g
Flags
Result

Enter a pattern and a test string to see matches.

What is Regex Tester?

A regular expression is a pattern that describes a set of strings, used to search, match, validate, and extract text, with the pattern syntax formalized in standards such as ECMAScript and POSIX. This tool evaluates your pattern against a test string using JavaScript's native RegExp engine — the same engine used by your browser and Node.js — so its behavior matches production. Every match is highlighted inline, and numbered and named capture groups are listed for each result, with the global (g) flag applied automatically so all matches are found rather than just the first. Invalid patterns surface as real syntax errors rather than being silently swallowed.

How to Use Regex Tester

  1. Type or paste a regular expression pattern into the Pattern field (without the surrounding slashes).
  2. Toggle flags — g is always applied automatically so every match is found, not just the first.
  3. Paste the text you want to test into the Test string box.
  4. Matches are highlighted inline, and each match's captured groups are listed below with their index.

Examples

Match digits

Input: \d+ → a1 b22 c333

Output: 1, 22, 333

Named groups

Input: (?<user>\w+)@(?<domain>\w+) → user@example

Output: user: user, domain: example

Case-insensitive flag

Input: hello (flag: i) → HELLO world

Output: HELLO

Common Mistakes

  • Forgetting to escape special regex characters (. * + ? ( ) [ ] { } | ^ $ \) when you mean them literally — e.g. matching a literal period needs \. not just ..
  • Using greedy quantifiers (.*) when a non-greedy one (.*?) is what's actually needed, causing a match to swallow far more text than intended.
  • Assuming ^ and $ anchor to line boundaries by default — without the m flag they anchor to the start/end of the entire string.
  • Testing a pattern meant for another regex flavor (PCRE, Python's re, etc.) — small syntax differences (like named group syntax) can cause it to behave differently in JavaScript.

Why Use This Tool

  • Highlights every match inline against your actual test string, not just a match count.
  • Shows both numbered and named capture groups for each match.
  • Uses the exact same RegExp engine as your browser and Node.js, so behavior matches production.
  • Runs entirely client-side — your pattern and test data are never sent anywhere.

Frequently Asked Questions