ToolsGiver

Developer

Regex Tester

Test regular expressions live. Highlighted matches, captured groups, replace preview. JavaScript syntax. No upload.

//gi
Reach us at hello@toolsgiver.com or support@example.org. Old contact was sales@old-domain.io, now defunct. Not an email: just @symbol or fake.address

hello@toolsgiver.com

@ 12

support@example.org

@ 36

Overview

What this tool does

A regex tester lets you write a regular-expression pattern, throw text at it, and immediately see what matches and what doesn't. This tester uses your browser's native JavaScript regex engine, which is the same engine Node.js and most JS runtimes use. Every match in the test string is highlighted live as you type, captured groups (numbered and named) are listed for each match, and a replace preview lets you check what your replacement template will produce. Useful for extracting structured data from logs, validating user input formats (emails, phone numbers, dates), refactoring code with safe find-and-replace, or just learning how a tricky pattern actually behaves. 100% client-side; nothing you type is sent anywhere.

How to

Use it in 3 steps

  1. Type a regular-expression pattern into the Pattern field (without the surrounding slashes).
  2. Pick flags: g (find all), i (case-insensitive), m (multiline), s (dot matches newlines), u (Unicode), y (sticky).
  3. Paste or type the text you want to test against into the Test string textarea.
  4. Look at the Match highlight pane on the right. Every match is highlighted in terracotta. The captured-groups panel below lists each match with its position and any $1, $2, or named groups.
  5. Toggle 'Show replace' to preview a find-and-replace. Use $1, $2, etc. to reference captured groups; use $& for the whole match.

FAQ

Frequently asked questions

Which regex syntax does this use?

Standard ECMAScript / JavaScript regex (the same as RegExp in JS, the regex in Node.js, and the patterns in JSON Schema). It does NOT support PCRE-only features like recursion, possessive quantifiers, or conditional groups. If your pattern was written for Perl/PHP/Python, some advanced features may need rewriting.

How do I match a literal forward slash, dot, or other special char?

Escape it with a backslash. \. matches a literal dot, \/ a literal forward slash, \$ a literal dollar sign. The surrounding /…/ slashes in the display are just visual; you type the pattern without them.

Why does my pattern with /g find only one match without the global flag?

Without the g flag, JavaScript regex stops at the first match. The Matches panel always behaves as if g is on so you can see every match while iterating; the slash-flag display still reflects exactly the flags you've enabled (some downstream code cares which flags you actually set).

What's the difference between (?:...) and (...) groups?

Both group the pattern, but only (...) captures. Non-capturing groups (?:...) save memory and don't pollute your $1, $2 indices. Use them for alternation or grouping that you don't need to reference in replacement.

Can I use named groups?

Yes. Use (?<name>...) to name a group; the named-group panel shows the captured value under the name. Reference it in replacement with $<name>.

Is my pattern or test data sent anywhere?

No. Pattern compilation and matching run in your browser's regex engine. Nothing leaves your device.

Related

You might also like