/

Regex Tester

Test JavaScript regular expressions with live match highlighting, capture-group inspection, and a replace mode.

Jump to section
Complete your workflow โ†’
Advertisement
Ad ยท responsive

How to Use the Regex Tester

Enter your regular expression in the pattern bar at the top. The โ€œ/โ€ delimiters and flag toggles work just like a JavaScript regex literal. Matches are highlighted live in the test string below as you type. Switch between the Matches, Groups, and Replace tabs to explore results in different ways. Use the pattern library to load common patterns and test strings with one click. Click Share to generate a permalink with your pattern and test string encoded in the URL.

About This Tool

A real-time regular expression tester that runs JavaScriptโ€™s native RegExp engine in your browser. Three result modes cover every use case: Match mode highlights all matches with position and line information, Groups mode displays numbered and named capture groups in a table, and Replace mode previews regex find-and-replace results live with highlighted replacements. A built-in pattern explanation breaks down your regex into human-readable tokens โ€” turning this into a learning tool as well as a testing tool. Common patterns from a built-in library load with one click. Zero external libraries, zero server communication โ€” your data never leaves your device. Related: format API responses for pretty-printing the JSON your regex pulled out, and decode URL-safe strings when your test data contains percent-encoded characters.

Quick Reference Table

TokenMeaning
.Any character (except newline without s flag)
\d \w \sDigit, word char, whitespace
\D \W \SNon-digit, non-word, non-whitespace
[abc]Character class: a, b, or c
[^abc]Negated class: not a, b, or c
(x)Capture group
(?:x)Non-capturing group
(?<name>x)Named capture group
x* x+ x?0+, 1+, or 0/1 occurrences
x{n,m}Between n and m occurrences
^ $Start / end of string (or line with m)
\bWord boundary
x|yx or y (alternation)

Frequently Asked Questions

Why does my regex match in JavaScript but not in Python?

Regex syntax varies between languages. This tool uses JavaScriptโ€™s RegExp engine specifically. Python uses different escaping conventions, and some engines support features JavaScript does not (atomic groups, PCRE extensions). Always test in your target language.

Why are my matches not overlapping?

JavaScriptโ€™s regex engine advances past each match before looking for the next one. Overlapping matches are not returned natively. Using a lookahead like (?=(...)) can work around this in some cases.

What is the difference between greedy and lazy matching?

Greedy quantifiers (*, +, ?) match as much text as possible. Lazy variants (*?, +?, ??) match as little as possible. For example, <.+> on โ€˜<b>hello</b>โ€™ matches the entire string, while <.+?> matches โ€˜<b>โ€™ and โ€˜</b>โ€™ separately.

How do I match a literal dot or parenthesis?

Escape special characters with a backslash: \. matches a literal dot, \( and \) match literal parentheses. Special regex characters: . * + ? ^ $ { } [ ] | ( ) \

Does the Regex Tester send my patterns or test strings to any server?

No. The Regex Tester compiles and runs your regular expression entirely in your browser using the native JavaScript RegExp engine. Your patterns, flags (g, i, m, s, u, y), test strings, capture groups, and find-and-replace output all stay on your device โ€” nothing is transmitted to any server.

The Toobits Team

Created by The Toobits Team ยท Engineering & Editorial

Toobits is built, tested, and maintained by a small independent engineering team. Every tool is written in TypeScript, runs entirely in the browser, and is reviewed against its source formulas before publication.

Editorial policy ยท Updated April 2026

Advertisement
Ad ยท responsive