Test Regular Expressions Instantly (Live Matches & Capture Groups)
Test and debug regular expressions with live highlighting, capture groups, and match details. Supports all JavaScript regex flags (g, i, m, s, u).
How to Use Regular Expression Tester
What is a Regular Expression?
A regular expression (regex) is a pattern used to match character combinations in strings. Regex is incredibly powerful for validation, searching, extracting, and replacing text in programming.
Regex Syntax Basics
- Literal characters:
abcmatches "abc" exactly - Character classes:
[abc]matches a, b, or c;[0-9]matches any digit - Negated classes:
[^abc]matches anything except a, b, or c - Quantifiers:
*(0+),+(1+),?(0 or 1),{n}(exactly n),{n,m}(between n and m) - Anchors:
^(start of line),$(end of line),\b(word boundary) - Groups:
(abc)captures group,(?:abc)non-capturing group - Alternation:
a|bmatches a or b - Escape:
\.matches literal dot (escape special chars with\)
How to Use This Tool
Test a Pattern
- Enter your regex pattern in the Pattern field (without
/delimiters) - Toggle flags as needed:
- g (global): Find all matches, not just the first
- i (case-insensitive): Match regardless of case
- m (multiline):
^and$match line starts/ends - s (dotAll):
.matches newlines too - u (unicode): Full unicode support
- Paste your test text in the Test Text area
- Click Run Test to execute the pattern
- View highlighted matches in the "Matches in Text" section
- See detailed match info including positions and captured groups
Example Patterns
- Email:
\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b - URL:
https?://[^\s]+ - Phone (US):
\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4} - Hex color:
#[0-9A-Fa-f]{6}\b - Date (YYYY-MM-DD):
\d{4}-\d{2}-\d{2} - IP Address:
\b(?:\d{1,3}\.){3}\d{1,3}\b
Common Use Cases
- Form Validation: Validate email, phone, password patterns in real-time
- Data Extraction: Extract emails, URLs, dates, or IDs from logs or documents
- Search & Replace: Find patterns in text files for bulk editing
- Log Parsing: Extract error codes, timestamps, or user IDs from server logs
- String Cleaning: Remove unwanted characters or normalize formats
- Testing Regex: Debug patterns before implementing in code
- Learning Regex: Experiment with patterns and see matches instantly
Understanding Flags
- g (global): Without this, only the first match is found. With
g, all matches are returned. - i (ignore case):
hellomatches "Hello", "HELLO", "hElLo", etc. - m (multiline):
^matches start of each line,$matches end of each line (not just start/end of entire string). - s (dotAll): Normally
.doesn't match newlines. Withs, it does. - u (unicode): Enables full unicode matching (important for emoji, accented characters, etc.).
Captured Groups
When you use parentheses () in your pattern, regex captures those parts:
- Pattern:
(\w+)@(\w+)\.(\w+) - Text:
hello@example.com - Match:
hello@example.com - Groups:
$1 = hello,$2 = example,$3 = com
Use groups to extract specific parts of matches or for backreferences.
Tips
- Start simple: Test with a basic pattern, then add complexity
- Use
\bfor word boundaries:\bcat\bmatches "cat" but not "catch" - Escape special characters:
.,*,+,?,[,],{,},(,),^,$,|,\need\before them to match literally - Test edge cases: Empty strings, very long strings, special characters
- Use non-capturing groups
(?:...)when you don't need to extract: Faster and cleaner - Avoid catastrophic backtracking: Patterns like
(a+)+bcan hang on long strings without matches
Frequently Asked Questions
Most Viewed Tools
TOTP Code Generator
Generate time-based one-time passwords from a TOTP secret key. Enter your base32 secret, choose a period and digit length, and get the current and next codes with a live countdown timer. Useful for testing and debugging 2FA integrations.
Use Tool →JSON to Zod Schema Generator
Generate Zod validation schema code from a JSON sample object. Infers z.string(), z.number(), z.boolean(), z.array(), z.object(), and z.null() types automatically. Handles nested objects, arrays of objects with optional field detection, and outputs copy-ready TypeScript with import and z.infer type alias.
Use Tool →JSONL / NDJSON Formatter
Format, validate, and inspect JSON Lines (JSONL) and NDJSON files. Validates each line individually, reports parse errors by line number, outputs compact JSONL or a pretty-print preview, and lets you download the cleaned file.
Use Tool →Secret and Credential Scanner
Scan pasted text, code, or config files for accidentally exposed API keys, tokens, passwords, and private keys. Detects 50+ secret types across AWS, GitHub, Stripe, OpenAI, and more — all client-side, nothing leaves your browser.
Use Tool →TLS Cipher Suite Checker
Check TLS protocol version compatibility and cipher suite strength ratings against current best practices. Supports IANA and OpenSSL cipher names — rates each suite as Strong, Weak, or Deprecated and explains why.
Use Tool →Password Entropy Calculator
Calculate the information-theoretic bit entropy of any password or API key. Detects character set pools automatically, shows the total number of possible combinations, and estimates crack time across five attack scenarios from rate-limited web logins to GPU cracking clusters.
Use Tool →TOML Config Validator
Validate TOML configuration file syntax and report errors with line numbers. Paste any TOML content — Cargo.toml, pyproject.toml, config.toml — and instantly see a green checkmark with key counts and structure stats, or a precise error message pointing to the exact line. Includes a collapsible JSON structure preview to confirm what was parsed.
Use Tool →Content Security Policy Generator
Build Content Security Policy headers interactively. Toggle directives like script-src, style-src, and img-src, select allowed source tokens, and add custom origins. Instantly outputs your CSP as an HTTP header, meta tag, Nginx directive, or Apache header.
Use Tool →Related Development Tools
QR Code Generator
FeaturedCreate custom QR codes for URLs, text, and contact info
Use Tool →TOML to JSON Converter
Convert TOML configuration files to JSON format instantly. Paste any TOML — Cargo.toml, pyproject.toml, config.toml — and get clean, pretty-printed JSON output. Supports all TOML types: strings (basic, literal, multi-line), integers (decimal, hex, octal, binary), floats, booleans, datetimes, arrays, inline tables, tables, and arrays of tables.
Use Tool →JSONL / NDJSON Formatter
Format, validate, and inspect JSON Lines (JSONL) and NDJSON files. Validates each line individually, reports parse errors by line number, outputs compact JSONL or a pretty-print preview, and lets you download the cleaned file.
Use Tool →HTML Table to CSV Extractor
Extract HTML table markup and convert it to clean CSV format. Paste any HTML snippet or full page source — the tool finds the table, parses thead and tbody rows, handles colspan and rowspan merging gracefully, and outputs a properly quoted CSV ready to download or paste into a spreadsheet. When multiple tables are found, switch between them with a click.
Use Tool →TOML Config Validator
Validate TOML configuration file syntax and report errors with line numbers. Paste any TOML content — Cargo.toml, pyproject.toml, config.toml — and instantly see a green checkmark with key counts and structure stats, or a precise error message pointing to the exact line. Includes a collapsible JSON structure preview to confirm what was parsed.
Use Tool →INI / Properties to JSON Converter
Convert INI configuration files and Java .properties files to JSON format instantly. Paste any INI file — php.ini, app.ini, Windows .ini — or a Java .properties file with dotted keys and get clean, structured JSON output. Supports section headers, inline comments, quoted values, boolean coercion (true/false/yes/no/on/off), numeric parsing, continuation lines, and Unicode escapes.
Use Tool →JSON to TypeScript Interface
Generate TypeScript interfaces from JSON objects instantly. Infers types for strings, numbers, booleans, arrays, and nested objects. Detects optional fields from array element merging, handles null values, and outputs clean, ready-to-use interface definitions.
Use Tool →CSV Pivot Table Generator
Group and aggregate CSV data by one or more columns to create summary pivot views. Supports Count, Sum, Average, Min, and Max aggregations with multi-column grouping. Paste or upload any CSV, select group-by columns and aggregation type, and download the pivot summary as a new CSV file. Runs entirely in your browser.
Use Tool →Share Your Feedback
Help us improve this tool by sharing your experience