JSON, Data & Formatter Tools

Free Regex Tester and Debugger

A browser-based regular expression tester that runs JavaScript regex against any text input. See live matches with highlighted output, inspect capture groups, and preview replacement results. Supports all JavaScript regex flags (g, i, m, s, u, y). No data is sent to a server — all matching happens locally.

Loading tool...

What is Regex Tester and Debugger?

A browser-based regular expression tester that runs JavaScript regex against any text input. See live matches with highlighted output, inspect capture groups, and preview replacement results. Supports all JavaScript regex flags (g, i, m, s, u, y). No data is sent to a server — all matching happens locally.

quickAnswer

Write a JavaScript regex pattern, set flags, and test it against any text. See highlighted matches, capture groups, and replacement previews instantly.

Last updated: 2026-06-05

limitations

  • Uses JavaScript regex engine — patterns from Python, PHP, or Go may have slightly different syntax or features that are not supported.
  • Very long test strings (over 100KB) may cause slow matching, especially with complex patterns that have nested quantifiers.
  • Does not support regex flavors from other languages — no PCRE-specific features like recursive patterns or possessive quantifiers.

Sources:MDN Web Docs · W3C Specifications · jquery.app on GitHub

How to use this tool

  1. Enter your regular expression pattern and any flags (g, i, m, s, u, y).
  2. Paste or type the text you want to test against.
  3. Review highlighted matches and capture group details.
  4. Optionally enter a replacement string to preview the replace result.

What you can use it for

  • Test a regex pattern before adding it to JavaScript code to confirm it matches the expected strings.
  • Debug a regex that is not matching as expected by inspecting capture groups and flags.
  • Extract email addresses, URLs, or phone numbers from text using regex patterns with immediate visual feedback.

Use cases

Practical examples

example

Extract email addresses from text

A developer needs to extract all email addresses from a document. They use the pattern (\w+@\w+\.\w+) with the global flag and see all matches highlighted with capture groups for the username and domain.

example

Test a URL validation regex

A QA engineer wants to verify a URL regex pattern before adding it to form validation. They test the pattern https?://[\w.-]+/\S* against several URLs and verify which ones match, adjusting the pattern based on the results.

Common mistakes

  • Forgetting to escape special regex characters like . * + ? [ ] ( ) { } | \ when matching literal text.
  • Using the global flag (g) with test() in JavaScript — test() with /g advances lastIndex and can return alternating results.
  • Expecting \d to match only ASCII digits without the u flag — in some engines \d matches Unicode digits too.

verification

  1. Enter a simple pattern like \d+ and a test string with numbers. Confirm matches are highlighted and the match count is correct.
  2. Test with capture groups like (\w+)@(\w+) and verify each group is shown separately in the output.

FAQ

Questions about Regex Tester and Debugger

Which regex engine does this tester use?

This tester uses the JavaScript RegExp engine (the same engine used in every browser). Patterns that work here will work in Node.js, Chrome, Firefox, and any JavaScript environment. Regex from other languages like Python or PHP may need adjustments for JavaScript syntax.

What do the regex flags mean?

g = global (find all matches, not just the first). i = case-insensitive. m = multiline (^ and $ match line boundaries). s = dotAll (. matches newlines too). u = unicode (enable Unicode features). y = sticky (match exactly at lastIndex). Combine flags like 'gi' or 'gims' as needed.

Can I use lookbehind assertions?

Yes, JavaScript supports lookbehind assertions (?<=...) and negative lookbehind (?<!...) in modern browsers (Chrome 62+, Firefox 78+, Safari 16.4+). These work in this tester.

Related tools

More json, data & formatter tools

JSON, Data & Formatter Tools

JSON Formatter & Validator

Format, validate, minify, and tree-view JSON data. Detects trailing commas, shows error position with context. All processing happens in the browser -- no data sent anywhere.

Open tool

JSON, Data & Formatter Tools

JSON to CSV Converter

Convert JSON arrays to CSV/TSV with configurable delimiter, optional header row, nested field flattening via dot notation, and download-ready output.

Open tool

JSON, Data & Formatter Tools

YAML JSON Converter

Bidirectional YAML to JSON and JSON to YAML converter. Handles nested objects, arrays, and scalar values. Useful for config files, GitHub Actions, front matter, and Docker Compose.

Open tool

Also try

Also try

Encoders, Hash & Security Tools

COOP/COEP/CORP Header Builder

Build Cross-Origin isolation headers for SharedArrayBuffer, WebAssembly threads, and cross-origin security. Choose from presets with debugging checklists.

Open tool

Encoders, Hash & Security Tools

CORS Header Generator

Generate CORS HTTP headers for any origin, method, and credential configuration. Output in raw HTTP, Nginx, Apache, Express, or Cloudflare Workers format.

Open tool

Encoders, Hash & Security Tools

CSP Hash Generator

Generate CSP hash values for inline scripts and styles. Hash exact code content with SHA-256, SHA-384, or SHA-512 and get the matching CSP directive snippet.

Open tool