Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. All processing happens entirely in your browser - your files never leave your device. No uploads, no accounts, complete privacy.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. Document & Text
  3. Regex Tester & Debugger
Add to favorites

Regex Tester & Debugger

Test regex patterns with live matching, capture groups, flags (g/i/m/s/u), pattern library with common expressions, find & replace, and detailed match breakdown

Regex flavors are not interchangeable. The pattern that works in your text editor may fail in your code because JavaScript, PCRE (used by PHP, Perl, and grep -P), Python's re module, .NET regex, and POSIX BRE/ERE implement subtly different features. Lookbehind assertions work in JavaScript (ES2018+), Python, and .NET but not in Ruby or older Safari. Possessive quantifiers (a++) exist in PCRE and Java but not in JavaScript. Named capture groups use different syntax across flavors: (?P<name>...) in Python, (?<name>...) in JavaScript and .NET, and (?P<name>...) or (?<name>...) in PCRE depending on version. This tester runs the JavaScript (ECMAScript) regex engine, which is what the browser and Node.js use, so the results here match production behavior in any JavaScript-based system. Beyond flavor differences, the most dangerous pitfall in regex is catastrophic backtracking. A pattern like `(a+)+b` matching against `aaaaaaaaaaaaaaaaaaaaaac` takes exponential time because the engine tries every possible way to split the a's between the inner and outer groups. Real-world examples brought down Cloudflare in 2019 and Stack Overflow in 2016. This tester shows match time and warns when patterns exhibit backtracking behavior on your test input, which catches the bug at build time rather than in production.

Runs in your browser and files never uploadedMore document & textJump to full guide

Related reading

  • Regex Patterns for Common Use Cases: Emails, URLs, Dates & More14 min read

Initializing in your browser…

You might also like

XPath Tester

Test and debug XPath expressions against XML documents. See matched nodes, values, and counts in real-time.

Text Case Converter

Convert text between 12 cases: UPPERCASE, lowercase, Title Case, camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, dot.case, path/case, Sentence, and Alternating

Word Counter & Text Analyzer

Count words, characters, paragraphs, sentences with reading time, speaking time, readability scores (Flesch, Gunning Fog), and word frequency analysis

Regex Tester & Debugger: a worked example

You wrote a pattern to pull order IDs from log lines and need to confirm it matches the real format and captures the number.

Pattern + test string

/order-(\d{4,})/g  on  "ok order-10473 then order-9 fail"
Regex Tester & Debugger produces

Matches

Match 1: "order-10473"  group 1 = 10473
("order-9" rejected, needs 4+ digits)

Every match and capture group is highlighted live against your real sample, so you immediately see that the `{4,}` quantifier correctly excludes the 1-digit case. An explainer breaks the pattern into plain English, turning regex debugging from trial-and-error into something you can reason about.

Test Regular Expressions Instantly

Regex flavors are not interchangeable. The pattern that works in your text editor may fail in your code because JavaScript, PCRE (used by PHP, Perl, and grep -P), Python's re module, .NET regex, and POSIX BRE/ERE implement subtly different features. Lookbehind assertions work in JavaScript (ES2018+), Python, and .NET but not in Ruby or older Safari. Possessive quantifiers (a++) exist in PCRE and Java but not in JavaScript. Named capture groups use different syntax across flavors: (?P<name>...) in Python, (?<name>...) in JavaScript and .NET, and (?P<name>...) or (?<name>...) in PCRE depending on version. This tester runs the JavaScript (ECMAScript) regex engine, which is what the browser and Node.js use, so the results here match production behavior in any JavaScript-based system. Beyond flavor differences, the most dangerous pitfall in regex is catastrophic backtracking. A pattern like `(a+)+b` matching against `aaaaaaaaaaaaaaaaaaaaaac` takes exponential time because the engine tries every possible way to split the a's between the inner and outer groups. Real-world examples brought down Cloudflare in 2019 and Stack Overflow in 2016. This tester shows match time and warns when patterns exhibit backtracking behavior on your test input, which catches the bug at build time rather than in production.

How to use

  1. 1Enter your regular expression in the pattern field
  2. 2Set flags (g, i, m, s, u) as needed
  3. 3Type or paste test strings below
  4. 4View highlighted matches and capture group details in real time
  5. 5Adjust your pattern until it matches exactly what you expect

Key features

  • Real-time match highlighting as you type
  • Capture group extraction with named group support
  • Flag toggles: global, case-insensitive, multiline, dotAll, unicode
  • Match index positions displayed for each match
  • Quick-reference cheat sheet for regex syntax
  • Multiple test strings for batch testing
  • Detailed error messages for invalid patterns

Common use cases

  • Validating input patterns

    Build and test regex patterns for email addresses, phone numbers, URLs, or custom input formats before embedding them in your code.

  • Parsing log files

    Craft patterns to extract timestamps, error codes, or IP addresses from log entries, verifying matches against sample lines.

  • Search-and-replace preparation

    Test complex find-and-replace patterns with capture groups before running them across a codebase or document.

  • Learning regular expressions

    Experiment with regex syntax and instantly see what matches, a much faster feedback loop than modifying and re-running scripts.

Examples

  • Email validation

    Pattern: ^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,}$, matches standard email addresses.

  • Extract date components

    Pattern: (\d{4})-(\d{2})-(\d{2}), captures year, month, and day from ISO dates.

How it works

The tester evaluates your regex with every keystroke, highlighting matches in the test string and listing capture groups separately. Each of JavaScript's six regex flags has distinct behavior: the `g` flag makes a pattern stateful (lastIndex advances between matches, which matters when you use the same RegExp object for multiple tests), the `i` flag makes matching case-insensitive using Unicode case folding when the `u` flag is also set, the `m` flag changes `^` and `$` to match at line boundaries rather than only at string boundaries, the `s` flag makes `.` match newlines (without `s``.` matches everything except `\n`), the `u` flag enables proper Unicode handling including surrogate pair support for characters outside the BMP, and the `y` flag performs sticky matching anchored at lastIndex.

Capture groups come in three forms. Numbered groups `(...)` are the classic form, referenced by `$1``$2`etc. in replacements. Named groups `(?<name>...)` are referenced by `$<name>` and make complex patterns dramatically more readable, a date-parsing regex using named groups like `(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})` is far clearer than one relying on position alone. Non-capturing groups `(?:...)` group atoms for quantifiers without allocating a capture slot, which matters for performance on patterns used in tight loops. The tester displays each capture group separately with the captured substring and its position, making it easy to verify that group boundaries are where you expect.

Common patterns that trip up regex writers: matching email addresses is famously harder than it looks (the RFC 5322 grammar for valid email is about 6,400 characters as a regex, so most validators use a simplified approximation that accepts some invalid addresses and rejects some valid ones). Matching URLs has the same problem plus the complication of internationalized domain names. Matching HTML with regex is actively harmful because HTML is not a regular language, use a real parser. For CSV parsing, regex can handle simple cases but falls over on embedded commas, quoted strings, and multiline fields, so use a CSV library. The tester is best used for validating specific field formats where the grammar is actually regular: phone numbers, postal codes, semver strings, hex color codes, and log-line patterns where the source format guarantees regularity.

Frequently asked questions

Which regex engine does this use?

It uses the JavaScript (ECMAScript) regex engine, which is what runs in all modern browsers and Node.js.

Can I test regex for Python or other languages?

Most basic patterns are cross-compatible. However, features like lookbehinds, possessive quantifiers, or atomic groups may differ between engines. This tool reflects JavaScript behavior.

What do the flags mean?

g = match all occurrences (not just the first), i = case-insensitive, m = ^ and $ match line boundaries, s = dot matches newlines, u = full Unicode matching.

Private by design

Your text is processed locally in the browser. Nothing you paste or open is transmitted or logged.