Regex Tester

Test regular expressions live with match highlighting, capture groups, and replace mode. 100% client-side — nothing sent to any server.

//g
217 chars
2 matches
Contact us at support@codekeet.com or sales@codekeet.com. Visit https://codekeet.com for details. Call +1-555-123-4567 or +1-555-987-6543. Order #12345 was placed on 2026-09-20. Order #67890 was placed on 2026-09-21.

📋 Match Details

Match #1position 14, length 20
support@codekeet.com
Match #2position 38, length 18
sales@codekeet.com

About Regex Tester

A regular expression (regex) is a sequence of characters that defines a search pattern. Regex is used everywhere: form validation (emails, phone numbers), text parsing (logs, CSV), search-and-replace in editors, routing in web frameworks, and lexical analysis in compilers. Regex syntax is powerful but notoriously hard to read — a small change can break everything. This tester lets you write a regex, apply it to sample text, and see matches highlighted instantly with capture groups, positions, and named groups. A replace mode previews substitutions, and a library of common patterns helps you get started quickly.

How It Works

  1. Enter a regex pattern in the pattern field (without slashes).
  2. Toggle flags: g (global), i (case-insensitive), m (multiline), s (dotall), u (unicode), y (sticky).
  3. Paste or type sample text in the test string area.
  4. Matches highlight live in the text; capture groups and positions appear below.
  5. Switch to Replace mode to preview substitutions with $1, $2, $&, etc.

✨ Key Features

  • ✓Live regex matching with instant highlight
  • ✓All JavaScript regex flags: g, i, m, s, u, y
  • ✓Capture groups (numbered and named) displayed
  • ✓Match positions and lengths
  • ✓Replace mode with backreferences ($1, $2, $&)
  • ✓Common regex patterns library (email, URL, phone, IP)
  • ✓Error messages for invalid regex
  • ✓Match counter
  • ✓100% client-side — nothing sent to any server

🎯 Common Use Cases

  • →Debugging complex regex patterns
  • →Testing email or phone number validation
  • →Parsing log lines and extracting fields
  • →Testing URL routing patterns
  • →Building search-and-replace operations
  • →Learning regex syntax interactively
  • →Extracting data from text (CSV, HTML, JSON snippets)
  • →Verifying patterns before embedding in code

💡 Advanced Tips & Pro Insights

  • ▸The g flag makes the regex find all matches. Without it, only the first match is returned.
  • ▸Use non-greedy quantifiers (.*?) instead of greedy (.*) when matching between delimiters — otherwise the match may span too much text.
  • ▸Named capture groups (?<name>...) are more readable than numbered $1, $2 — use them in complex regexes.
  • ▸JavaScript regex uses the same syntax as PCRE but with some differences: no atomic groups, no lookbehind in older engines (lookbehind is now supported in modern V8).
  • ▸For matching across multiple lines, enable the m flag (^ and $ match line boundaries) or the s flag (. matches newline).

Frequently Asked Questions

Is this regex tester free?▾
Yes, this regex tester is completely free with no signup, registration, or usage limits.
Is my data safe?▾
Yes, 100% safe. All matching and replacing happens in your browser. Your regex and test text never leave your device.
Which regex flavor does this tool use?▾
This tool uses JavaScript (ECMAScript) regular expressions — the same engine that runs in every browser and in Node.js. Syntax is similar to PCRE but with a few differences.
What do the flags mean?▾
g = global (find all matches), i = case-insensitive, m = multiline (^ and $ match line boundaries), s = dotall (. matches newlines), u = unicode mode, y = sticky (match only at lastIndex).
How do capture groups work?▾
Parentheses () create capture groups. Numbered groups are referenced as $1, $2, etc. Named groups (?<name>...) are referenced as $<name> (in replace) or via match.groups.name.
How do I use the Replace mode?▾
Enter the replacement string in the "Replace with" field. Use $1, $2 for numbered groups, $& for the full match, $` for pre-match text, and $' for post-match text.
Why is my regex slow?▾
Catastrophic backtracking can occur with nested quantifiers (e.g. (a+)+). If your regex runs slowly, simplify it, use non-greedy quantifiers, or use atomic groups (not supported in JS — restructure the pattern).
How do I match email addresses?▾
A common (imperfect) pattern is: ^[\w.+-]+@[\w-]+\.[\w.-]+$ — it covers most real emails but does not strictly follow RFC 5322. For production, use a dedicated email validation library or send a verification email.