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. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

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 JavaScript regular expressions live, with highlighted matches, capture groups, replace preview, plain-English explanations and code for eight languages.

Text processed locallyMore document & textJump to full guide
Related readingRegex Patterns for Common Use Cases: Emails, URLs, Dates & More10 min

Initializing in your browser…

You might also like

XPath Tester

Test XPath 1.0 expressions against XML as you type, with node-set, number, string and boolean results and automatic namespace prefixes.

Text Case Converter

Convert text to 17 case styles at once, including Title Case (Chicago, AP or APA), Sentence case, camelCase, snake_case and URL slugs, with one-click copy.

Word Counter & Text Analyzer

Count words, characters, sentences and paragraphs as you type, with reading time, six readability scores, an SEO checklist and keyword density.

Regex Tester & Debugger: a worked example

A support team wants to pull every email address out of a block of pasted text, with the user name and the domain in separate columns for a spreadsheet.

Pattern, flags gi, and text

/(?<user>[\w.+-]+)@(?<domain>[\w-]+(?:\.[\w-]+)+)/gi

Questions go to support@loopaloo.example, sales to
sales.team@shop.example.co.uk.
Old addresses like admin@legacy and @handle are not emails.
What Regex Tester & Debugger produces

2 matches, 2 groups

#1  characters 16 to 40   support@loopaloo.example
    user: support   domain: loopaloo.example
#2  characters 51 to 80   sales.team@shop.example.co.uk
    user: sales.team   domain: shop.example.co.uk

The domain part requires at least one dot followed by more letters, so admin@legacy is skipped, and because the repeat is (?:\.[\w-]+)+ rather than a run of dots and letters, the full stop that ends the sentence after co.uk is not swallowed into the address. @handle has no user part, so it cannot match. Exporting as CSV gives one row per match with the two named groups as columns, ready to paste into a spreadsheet.

About the Regex Tester & Debugger

Type a regular expression and some text, and every match is highlighted as you type, with its position and each capture group listed. Replace with $1-style references, explain a pattern token by token, start from a library of common patterns, and copy working code for eight languages.

How it works

Regular expressions are compact and powerful and very easy to get slightly wrong. A tester shows you immediately what a pattern actually matches, which is the only reliable way to write one. This tester uses your browser's own JavaScript engine, so what you see is exactly what JavaScript, Node.js and TypeScript will do with the same pattern and flags.

Live matching with details. Matches are highlighted in the text as you type. Below, each match shows its start and end position and the value of every capture group, named groups by name. Empty matches (patterns that match a position, such as \b or a lookahead) are marked rather than silently skipped, and if a pattern can match zero characters it is still stepped through the text correctly, including past emoji. All seven user-facing flags are available: global, ignore case, multiline, dot matches newline, unicode, unicode sets (v) and sticky (y). Results can be exported as JSON or CSV.

Protection from runaway patterns. Some patterns, such as (a+)+$, take exponentially long on text that almost matches, a problem known as catastrophic backtracking. The matching runs in a background worker with a five-second limit, so instead of freezing the tab the tool stops the search and explains what kind of pattern causes it and how to fix it. A pattern that does not compile shows the browser's error and a hint, and the match count is left blank rather than shown as zero, because no search took place.

Replace, explain and build. The Replace tab previews a find-and-replace across the whole text. Choose whether $ signs are read as JavaScript replacement patterns ($&, $1, $<name>, $$) or inserted literally, which avoids surprises when the replacement contains a price. The explanation lists each part of the pattern in plain English, distinguishing an escaped character from a quantifier and a character class from a group. The Builder assembles a pattern from blocks, escaping any exact text you add, and the Library offers ready-made patterns for emails, URLs, dates, IP addresses, colours, file paths and more as starting points.

Code for other languages. The Code tab turns the current pattern into a runnable snippet for JavaScript, Python, Java, PHP, C#, Go, Rust or Ruby, with the pattern escaped correctly for that language and the flags translated into its own options. Where engines differ it adapts or warns: named groups become (?P<name>) in Python, PHP gets no g modifier (it has none), Ruby's m flag is used for dot-matches-newline, and Go and Rust snippets note that their engines do not support lookaround or backreferences. Patterns and recent history are stored only in your browser.

How to use

  1. 1Type a pattern between the slashes, or press Try an example to load an email pattern with sample text.
  2. 2Toggle flags such as g (all matches), i (ignore case) or m (multiline) under the pattern.
  3. 3Paste or open the text to search. Matches are highlighted and listed with positions and capture groups.
  4. 4Open Explain this pattern to read each part of the expression in plain English.
  5. 5Use Replace to preview a substitution, Library for ready-made patterns, or Builder to assemble one from blocks.
  6. 6Open Code to copy the pattern as working code for your language, or export the matches as JSON or CSV.

Key features

  • Live highlighting with match positions and capture groups, including named groups
  • All seven flags: g, i, m, s, u, v and y
  • Background matching with a five-second limit, so runaway patterns cannot freeze the page
  • Clear error messages and hints for invalid patterns
  • Replace preview with literal or $-pattern substitution
  • Token-by-token explanation of the pattern
  • Library of common patterns and a block-based pattern builder
  • Runnable snippets for JavaScript, Python, Java, PHP, C#, Go, Rust and Ruby
  • Export matches as JSON or CSV, and a share link that keeps the pattern and flags
  • Everything runs locally in your browser

When to reach for this

  • Writing input validation

    Develop a pattern for a postcode, product code or username against real examples, then copy it into your form validation code.

  • Extracting data from logs

    Paste a log file, write a pattern with named groups for the timestamp and status, and export every match as CSV.

  • Planning a search and replace

    Preview a bulk rename or reformatting, such as swapping "Last, First" to "First Last" with $2 $1, before running it in your editor.

  • Learning and debugging regex

    Read the explanation of an inherited pattern to understand what each part does, and find out why it matches too much or too little.

Tips & best practices

  • Use named groups like (?<year>\d{4}) to make both the pattern and the match list easier to read.
  • Prefer a specific class such as [^"]* over .* inside delimiters; it is faster and stops at the right place.
  • Turn on u when working with emoji or non-Latin text so that . and character classes treat each character as one unit.
  • Anchor validation patterns with ^ and $ so that "abc123xyz" does not pass a check meant for "123".

Examples

  • Finding email addresses

    The built-in example (?<user>[\w.+-]+)@(?<domain>[\w-]+(?:\.[\w-]+)+) with flags gi finds support@loopaloo.example and sales.team@shop.example.co.uk, with user and domain captured separately, and correctly ignores admin@legacy and @handle.

  • Reformatting names

    Pattern (\w+), (\w+) with replacement $2 $1 turns "Lovelace, Ada" into "Ada Lovelace" when $ signs are read as patterns; read literally, the result would contain the characters $2 $1.

  • A pattern that runs away

    Pattern (a+)+$ against thirty a characters followed by a b would run for minutes in most engines. Here the search stops after five seconds with an explanation of nested quantifiers.

Frequently asked questions

Which regex flavour does this tester use?

JavaScript (ECMAScript), using the engine built into your browser. Results match what Node.js, Deno, TypeScript and browser code will do. Other languages are similar for everyday patterns but differ in details; the Code tab adapts the pattern where it can and warns where it cannot.

What do the g, i, m, s, u, v and y flags do?

g finds every match rather than the first. i ignores case. m makes ^ and $ match at each line break. s lets . match newlines. u enables full Unicode handling and \p{...} property escapes. v is a newer, stricter form of u with set operations in character classes. y (sticky) only matches at the exact current position.

Why does my pattern show no matches?

Check the flags first: without g only the first match is found, and without i case must match exactly. If ^ or $ are used on multi-line text, you probably need m. If the pattern is invalid, an error appears above the tabs and the count is left blank.

Why was my search stopped?

Some patterns, typically a repeated group that itself contains a repeat, such as (a+)+ or (\w+\s?)*, can take exponentially long when the text almost matches. The tester stops after five seconds instead of freezing. Rewrite the inner part so it cannot match the same text in more than one way, or anchor it.

How do I use capture groups in a replacement?

In the Replace tab, with "With $ patterns" selected, $1 to $99 insert numbered groups, $<name> inserts a named group, $& inserts the whole match and $$ inserts a dollar sign. Choose "Exactly as typed" if your replacement contains dollar amounts that should not be interpreted.

Are the library patterns good enough for validation?

They cover the common shapes and are a good starting point, but formats like email addresses and URLs are more varied than any short pattern can capture. For anything important, test with real data and rely on the receiving system for final validation.

Is my text sent anywhere?

No. Matching happens in a worker inside your browser. Recent patterns are saved in your browser's local storage on this device only, and the share link includes the test text only when it is short.

Related tools and how they differ

  • Text Diff & Compare Tool: Compares the text before and after a search and replace, line by line.
  • XPath Tester: Queries XML documents by structure, which is more reliable than a regular expression for markup.

Further reading

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

Private by design

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