Skip to main content
Toolisti

Regex Tester

Test, debug, and understand regular expressions with our powerful regex tester. Get real-time match highlighting, pattern explanations, code generation for 7 programming languages, and replace mode with backreferences.

//g
0 characters

All regex testing happens in your browser. Your data is never sent to any server.

🔗

Embed This Tool

Add this tool to your website with customizable styling

Get Embed Code

How to Use

  1. 1
    Enter your regex pattern — Type your regular expression in the pattern field. The pattern is validated in real-time and any syntax errors are displayed immediately.
  2. 2
    Configure flags — Toggle regex flags: Global (g) to find all matches, Ignore Case (i) for case-insensitive matching, Multiline (m) to make ^ and $ match line boundaries, and more.
  3. 3
    Enter test string — Paste or type the text you want to test against. Matches are highlighted in real-time with different colors for capture groups.
  4. 4
    View matches and groups — See all matches with their positions and capture groups. Named groups are displayed separately. Click any match to expand details.
  5. 5
    Use advanced features — Enable Replace mode for find-and-replace with backreferences ($1, $2). View Pattern Explanation to understand each part of your regex. Generate ready-to-use code for your programming language.

Frequently Asked Questions

What regex flags are available?

Global (g) finds all matches, Ignore Case (i) enables case-insensitive matching, Multiline (m) makes ^ and $ match line boundaries, Dot All (s) makes . match newlines, Unicode (u) enables full Unicode support, and Sticky (y) matches only at lastIndex position.

How do I use capture groups in replace mode?

Use $1, $2, etc. to reference captured groups in your replacement string. For example, with pattern (\w+)@(\w+) and replacement '$2 - $1', 'john@company' becomes 'company - john'. Named groups can be referenced with $<name>.

Which programming languages are supported for code generation?

We generate ready-to-use code for JavaScript, Python, PHP, Java, C#, Go, and Ruby. Each snippet includes proper escaping and the matching/replace logic for that language's regex API.

What are the quick patterns?

Quick patterns are pre-built regex patterns for common use cases: Email validation, URL matching, phone numbers, IPv4 addresses, dates (YYYY-MM-DD), times (HH:MM:SS), hex colors, and HTML tags. Click any to load it instantly.

How does the pattern explanation work?

The pattern explanation feature breaks down your regex into individual tokens and explains what each part does. It recognizes anchors, quantifiers, groups, character classes, escapes, alternations, and lookarounds, making complex patterns easier to understand.

Is my data secure?

All regex testing happens entirely in your browser. Your patterns and test strings are never sent to any server. Pattern history is stored locally in your browser's localStorage.

Can I save my regex patterns?

Yes! Your patterns are automatically saved to history as you work. You can view, load, favorite, or delete patterns from the History section. History is stored in your browser's localStorage and persists across sessions.

Why doesn't my pattern match what I expect?

Common issues include: forgetting the Global (g) flag to find all matches, not escaping special characters (. * + ? etc.), or using the wrong character class. Use the Pattern Explanation feature to verify what each part of your regex is doing.

Related Tools