Regex Tester
Test JavaScript regular expressions with live match highlighting, capture-group inspection, and a replace mode.
Jump to section โพ
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
| Token | Meaning |
|---|---|
| . | Any character (except newline without s flag) |
| \d \w \s | Digit, word char, whitespace |
| \D \W \S | Non-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) |
| \b | Word boundary |
| x|y | x 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.
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
Related tools
Hand-picked companions that pair well with this tool.
JSON Formatter
Format, validate, minify, and explore JSON with a tree view.
developerURL Encoder / Decoder
Encode or decode special characters for URLs instantly.
developerโฐCron Generator
Build and explain Unix cron schedule expressions visually.
developer#Hash Generator
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes from text.
developerNumber Base Converter
Convert numbers between binary, octal, decimal, and hexadecimal.
developer01Binary to Text Converter
Convert binary code to text and text to binary.
developerMore from Developer Tools
Other tools in the same category.
Internet Speed Test
Test your internet download, upload speed, and latency.
developerIP Address Lookup
Look up geolocation, ISP, and network details for any IP.
developerCSV to JSON
Convert CSV data to JSON arrays or objects instantly.
developerMarkdown to HTML
Convert Markdown to clean HTML with live preview.
developer๐จColor Palette Generator
Generate harmonious color palettes from any base color.
developerโContrast Checker
Check WCAG color contrast ratios for accessibility compliance.
developer