HTML 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.

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.

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 html tools

Html

ARIA Live Region Generator

Generate accessible ARIA live region HTML snippets with role, aria-live, aria-atomic, and aria-relevant attributes. Includes optional JavaScript update function.

Open tool

Html

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

Also try

Also try

Seo

AI Crawler robots.txt Builder

Build a robots.txt policy for AI crawlers. Choose from open, selective, or strict presets and block specific AI training bots while allowing search engines.

Open tool