Regex Lab - Test Regular Expressions Online

Regex pattern & test data
Write or paste a regex and test it against real logs.
Live evaluation
Regex pattern
Supports JavaScript-style regular expressions. Use \d, \w, groups( ), and character classes [ ].
Global matching is enabled by default so that all occurrences are highlighted.
Test data
Paste real log lines from Nginx, Kubernetes, application logs or JSON payloads. For sensitive data, scrub secrets before pasting.
These presets only change the test data. Use the cheat sheet on the right to load matching patterns.
Matches, groups & breakdown
See highlights, capture groups and a best-effort explanation.
Regex insights
Enter a regular expression to see how many matches it finds.
Add capturing groups ( ... ) to your pattern to see them listed here.

This is a best-effort explanation of common regex tokens (anchors, groups, character classes, quantifiers). Complex expressions may be simplified. Always rely on official documentation for critical use-cases.

Type a pattern to see a high-level summary here.
  • Start typing… Token-by-token explanations will appear here as you edit the pattern.
Log regex cheat sheet (click to load)
Natural language helper
Convert plain English to regex patterns (experimental)
Experimental

This helper uses a built-in regex cheat sheet and simple pattern rules. It may be wrong or incomplete. Always review the suggested pattern and try it in a non-production environment first.

Testing regular expressions can be challenging, especially when working with production logs. Our Regex Lab provides a safe, interactive environment to test and debug your patterns with real-time feedback and ReDoS (Regular Expression Denial of Service) protection.

Whether you’re parsing Nginx logs, Kubernetes events, JSON data, or custom formats, this tool helps you craft the perfect regex pattern before deploying to production.

How to Use Regex Lab?
  • Enter Your Pattern: Type your regex pattern in the input field at the top
  • Choose Flags: Enable global (g), case-insensitive (i), or multiline (m) matching
  • Add Test Data: Paste your log data, JSON, or text in the test area
  • See Results: View real-time matches, groups, and pattern breakdown
  • Load Samples: Click sample buttons to load common log formats

Our tool automatically detects potentially dangerous regex patterns that could cause catastrophic backtracking:

  • Nested quantifiers like (a+)+ or (a*)*
  • Alternation with quantifiers like (a+|b+)+
  • Backreferences with quantifiers
  • Excessive repetition ranges (>1000)
  • Instant feedback as you type
  • Match highlighting in your test data
  • Capture group visualization
  • Match count and summary

Quick access to common regex patterns for:

  • Email validation
  • IP addresses
  • URLs and domains
  • Dates and times
  • Log severity levels
  • And more…

Extract IP addresses, status codes, response times, and URLs from Nginx access logs.

Parse pod names, namespaces, timestamps, and error messages from kubectl output.

Extract specific fields from JSON logs and API responses.

Find and group errors by severity, component, or error code.

  • Start Simple: Begin with a basic pattern and refine it iteratively
  • Test Edge Cases: Include unusual inputs to ensure your pattern is robust
  • Watch for Performance: Pay attention to ReDoS warnings
  • Use Anchors: Use ^ and $ to match entire lines when needed
  • Escape Special Characters: Remember to escape .[]{}()*+?|^$\ when matching literally
  • Use Non-Capturing Groups: Use (?:...) instead of (...) when you don’t need to capture

No. All regex matching happens entirely in your browser. No data is transmitted to any server.

JavaScript regex (ECMAScript). Most patterns are compatible with other flavors, but some advanced features may differ.

Your pattern may cause exponential backtracking on certain inputs, which could freeze the browser. Simplify your pattern or avoid nested quantifiers.

Currently, patterns are not persisted. Consider bookmarking the page or copying patterns to your notes.

Enable the multiline (m) flag to make ^ and $ match line beginnings/endings, or use [\s\S]*? to match any character including newlines.