Regex Tester

100% private

Free online regex tester — test and debug regular expressions with live match highlighting, named capture groups, and full flag support. No signup.

Enter a pattern above to start matching.

This free online regex tester lets you write, test, and debug regular expressions against any text in real time. Enter your pattern, select flags (global g, case-insensitive i, multiline m, dotAll s), and paste your test string — matches are highlighted instantly with full capture group details. The tester runs the JavaScript RegExp engine directly in your browser, so results appear as you type and your test data never leaves your machine.

Although the engine is JavaScript and TypeScript, the core regex syntax is broadly compatible with Java regex (java.util.regex), Python regex (re module), PHP regex (preg_match PCRE), C# regex (System.Text.RegularExpressions), and Ruby regex for standard patterns. Engine-specific differences to watch: Java and PHP support possessive quantifiers (++, *+) which JavaScript does not; Python's re module supports verbose mode (?x); Go and RE2 do not support lookaheads or lookbehinds; nginx regex (PCRE) supports most features but not lookaheads in location blocks. For sed regex testing, note that sed uses POSIX ERE/BRE rather than PCRE.

As a developer-focused regex tool, this tester covers the most common use cases: matching emails, phone numbers, URLs, semantic version strings, log line patterns, and extracting named capture groups from structured text. It is the fastest workflow between writing a pattern and confirming it matches — no server round-trip, no latency, no account. Bookmark it as your go-to online regex tester for JavaScript, Python, Java, Go, PHP, Ruby, C#, TypeScript, nginx, and sed patterns.

How It Works

  1. Type or paste your regular expression into the pattern field
  2. Select the flags you need: g (global all matches), i (case-insensitive), m (multiline ^ and $), s (dotAll)
  3. Paste your test string — matches highlight in real time as you type
  4. Review each match, its start/end index, and all capture group values in the results panel

Features

  • Live match highlighting as you type — no Submit button required
  • Full capture group display: numbered groups and named groups (ES2018 (?<name>...) syntax)
  • All JavaScript regex flags: g, i, m, s, u, and y
  • Inline regex syntax error messages when the pattern is invalid
  • Match count and character index displayed for each result
  • 100% browser-based — your pattern and test data never leave the page

Examples

Match email addresses

Input

Pattern: [\w.-]+@[\w.-]+\.\w{2,}
Test: Contact us at hello@example.com or support@acme.io

Output

Match 1: hello@example.com
Match 2: support@acme.io

Extract version numbers with named groups

Input

Pattern: (?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)
Test: v2.14.0 released, v1.9.3 deprecated

Output

Match 1: 2.14.0 → major=2, minor=14, patch=0
Match 2: 1.9.3 → major=1, minor=9, patch=3

Common Use Cases

  • Validating email, phone number, IP address, and URL patterns before committing them to code
  • Extracting structured fields from log lines using named capture groups
  • Testing nginx location block patterns and rewrite rules against sample request paths
  • Debugging Java, Python, PHP, or C# regex patterns before porting to the target runtime
  • Learning quantifiers, lookaheads, lookbehinds, and named groups interactively

Developer Tips

  • The g flag is required to get all matches — without it only the first match is returned even if the pattern matches multiple times
  • Named capture groups (?<name>...) are ES2018 and supported in all modern browsers; prefer them over numbered groups for maintainable patterns
  • JavaScript lacks possessive quantifiers (++, *+) — if your pattern is destined for a PCRE engine (Java, PHP, nginx), test possessive variants separately in that runtime
  • For RE2-compatible patterns (Go, Rust regex crate), avoid lookaheads and lookbehinds — RE2 intentionally excludes them for guaranteed linear-time matching

Frequently Asked Questions

What is the best regex tester and maker tool?
The best online regex tester for developers is one that gives live match highlighting as you type, displays numbered and named capture groups, supports all standard flags, and runs entirely in the browser without sending your test data to a server. This free regex tester meets all four criteria. It uses the JavaScript RegExp engine, which is compatible with the majority of patterns written for Python, Java, PHP, C#, and TypeScript — making it a practical cross-language regex maker for everyday use.
What regex engine does this tester use?
This tester uses the JavaScript RegExp engine built into your browser. JavaScript regex supports the most common features: character classes, quantifiers, anchors, capture groups, non-capturing groups, lookaheads, lookbehinds, backreferences, and named groups. It does not support atomic groups or possessive quantifiers (PCRE-only). For Python, Java, Go, or PHP, core syntax is compatible but engine-specific features differ — always verify in the target runtime before deploying.
What do the regex flags mean?
The g (global) flag finds all matches instead of stopping at the first. The i (case-insensitive) flag makes matching ignore uppercase/lowercase differences. The m (multiline) flag makes ^ and $ match the start and end of each line rather than the entire string. The s (dotAll) flag makes the dot (.) match newline characters, which it normally skips. The u flag enables full Unicode mode, and the y flag enables sticky matching from the lastIndex position.
How do I test named capture groups?
Named capture groups use the syntax (?<name>pattern). For example, (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) captures date parts by name. This tester displays all named and numbered capture groups for each match so you can verify group names and their captured values. Named groups are available in JavaScript (ES2018), Python (re module), Java 7+, .NET, and PHP 7+.
Why does my regex match nothing when it should?
Common causes: missing the g flag when expecting multiple matches; using ^ and $ without the m flag in multiline text; forgetting to escape special characters like . * + ? ( ) [ ] { } \ | ^ $; a quantifier that is too greedy and consuming more than intended; or a lookahead/lookbehind assertion that fails silently. Enable the g flag first, then check each escaped character and quantifier carefully.
Can I use this to test regex for Python, Java, Go, or PHP?
Yes, for most common patterns. JavaScript regex is broadly compatible with Python re, Java java.util.regex, PHP PCRE, and C# regex for standard syntax. Key differences: Python supports verbose mode (?x) and re.DOTALL; Java and PHP support possessive quantifiers (JavaScript does not); Go's RE2 engine does not support lookaheads or lookbehinds; sed uses POSIX ERE/BRE, not PCRE. For production use in another language, always run a final test in that runtime before deploying.