Skip to main content
Developer Utility

Regex Tester

Test JavaScript regular expressions locally, inspect matches and capture groups, toggle flags, and preview replacement output without uploading text.

Regex examples and workflows

Use this tester for logs, API payloads, form validation, find-and-replace, and capture-group debugging.

How to use this tool

  1. Enter a JavaScript regular expression pattern without surrounding slashes.
  2. Toggle flags such as global, ignore case, multiline, dotAll, or unicode.
  3. Review matches, groups, indexes, and replacement output.

Real examples

  • Find all email-like strings in copied logs.
  • Capture URL slugs from route paths.
  • Preview a replace operation before changing source text.

Common use cases

  • Debug frontend validation patterns.
  • Extract IDs, timestamps, or status codes from logs.
  • Test capture groups before using them in JavaScript code.

Sample input/output

  • Pattern: ([a-z]+)@example\.com
  • Text: ada@example.com and lin@example.com.
  • Output: two matches with group 1 values ada and lin.

Common errors and fixes

  • Invalid regular expression: check unclosed groups, brackets, or escapes.
  • No matches: verify flags, anchors, whitespace, and case sensitivity.
  • Unexpected replacement: use $1, $2, and named groups carefully.

Edge cases table

Case What to check
Multiline anchors Use m when ^ and $ should apply per line.
Dot matches newline Use s when . should cross line breaks.
Global matching Use g to list all matches instead of only the first one.

Edge cases / errors

  • Catastrophic backtracking can freeze very large inputs.
  • Lookbehind support depends on the browser JavaScript engine.
  • Regex syntax differs between JavaScript, PCRE, Python, and RE2.

Use these tools around regex debugging and text extraction workflows.

Regex Tester FAQ

Practical details about JavaScript regex testing.

Does this upload my text?

No. Pattern matching and replacement preview run locally in your browser.

Which regex flavor is supported?

This page uses JavaScript RegExp syntax, matching modern browser behavior.

Can I inspect capture groups?

Yes. Each match row lists captured groups when the pattern contains parentheses.

Can I preview replacement text?

Yes. Enter replacement text and run the pattern to preview the replaced output.