Regex Tester & Debugger

Test regular expressions against sample text with Match, Test, and Replace modes, including named groups and $1 references — entirely in your browser.

Ready
 
Reference

Regular Expressions notes

What is Regular Expressions?

Regular expressions (regex) are patterns used to match character combinations in strings.

How does the Regular Expressions tool work?

Enter a regex pattern and optional flags, then choose a mode: 'Match' lists all matches with their index, positional groups and named groups; 'Test' returns whether the pattern exists; 'Replace' applies the replacement text (supports $1, $&, and named-group references) and shows the replaced result. Use the 'g' flag to find multiple matches and include other flags (i, m, u, y) as needed.

When should you use Regular Expressions?

  • Validating user input such as emails, phone numbers, and postal codes
  • Finding and replacing text across logs and configuration files
  • Extracting structured data like dates, URLs, and IDs from raw text
  • Debugging capture groups and named groups before using a pattern in code
  • Testing pattern behavior across flags (g, i, m, u, y) before deployment

What are the limitations of Regular Expressions?

  • Poorly written patterns can trigger catastrophic backtracking and freeze on long inputs
  • This tool uses the JavaScript regex engine, which differs from PCRE, RE2, and other engines in supported syntax
  • Complex patterns are hard to read and maintain without comments or tests
  • Regular expressions are not suited for parsing nested formats such as HTML or JSON

Regular Expressions examples

email ([a-z0-9._%+-]+)@([a-z0-9.-]+)\.([a-z]{2,}) -> Matches email addresses and captures user, domain and TLD groups
phone \+?\d{1,3}[ -]?\(?\d{1,4}\)?[ -]?\d{3,4}[ -]?\d{3,4} -> Matches many international phone number formats
groups (\d{4})-(\d{2})-(\d{2}) -> Captures year, month and day from YYYY-MM-DD
url https?:\/\/[^\s]+ -> Matches http/https URLs
ipv4 \b(?:(?:25[0-5]|2[0-4]\\d|1?\\d?\\d)\.){3}(?:25[0-5]|2[0-4]\\d|1?\\d?\\d)\b -> Matches IPv4 addresses with valid 0-255 ranges
uuid [0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12} -> Matches RFC4122 UUID strings
Related workflow

Automation & Patterns tools

Automation & Patterns
Cron Expression Builder Build readable cron expressions for scheduled jobs and translate minute, hour, day, month, and weekday fields into plain English.
Security & Identity
JWT Decoder and Encoder Decode JWT tokens, inspect JSON payloads, verify signatures with a secret, and generate HS256 tokens locally in your browser.
Data & Encoding
Base64 Encoder and Decoder Encode text or images to Base64, decode Base64 strings back to readable text, and preview image data URLs in the browser.
Data & Encoding
JSON Formatter & Validator Format, validate, pretty print, and minify JSON data in your browser for API responses, configuration files, and debugging.
Data & Encoding
JSON to TypeScript Interface Generator Convert JSON objects into TypeScript interfaces and generate sample JSON from simple TypeScript interfaces in your browser.
Security & Identity
UUID v4, v7 and v5 Generator Generate UUID v4, sortable UUID v7, namespace UUID v3/v5, GUID, URN, and hyphenless identifiers, then validate UUID strings locally.
Sharing
Custom QR Code Generator Create custom QR codes for URLs, Wi-Fi, vCard, email, SMS, events, and locations with a logo, gradients, module shapes, contrast check, and PNG, SVG, JPEG, or WebP export.
Security & Identity
Hash Generator Generate SHA-1, SHA-256, SHA-384, SHA-512, and BCrypt hashes from text for checksums, password hashing, and integrity checks.
Security & Identity
Password Generator Generate secure random passwords with customizable length, uppercase, lowercase, digits, and symbols for strong credentials.
Data & Encoding
URL Encoder and Decoder Encode and decode URLs, query strings, and text safely for web requests, links, and browser navigation.
Data & Encoding
Timestamp Converter Convert Unix timestamps, ISO dates, local time, UTC time, and timezone offsets directly in your browser.
Data & Encoding
YAML Formatter and YAML to JSON Format simple YAML, convert YAML to JSON, and convert JSON back to readable YAML for configs and manifests.
Text & Documents
Text and JSON Diff Checker Compare two text or JSON snippets side by side and review added, removed, and changed lines locally.
Network & Web
HTTP Headers Analyzer Parse HTTP headers into a table and highlight cache, security, CORS, and content negotiation signals.
Network & Web
CIDR and IP Subnet Calculator Calculate IPv4 network ranges, masks, usable hosts, broadcast addresses, and CIDR prefix details.
Design
Color Converter and Contrast Checker Convert HEX, RGB, and HSL colors and check WCAG contrast ratios for accessible UI color pairs.
Network & Web
User Agent Parser Parse browser user agent strings into browser, engine, operating system, device, and bot hints.
Text & Documents
SQL Formatter Format SQL queries with readable indentation, keyword casing, and line breaks for debugging and reviews.
Text & Documents
Markdown Preview Preview Markdown as HTML, inspect generated markup, and copy rendered HTML without sending text to a server.
Data & Encoding
HTML Entity Encoder and Decoder Encode text as HTML entities, decode entities back to text, and safely prepare snippets for markup.