Regex Tester
Test JavaScript regular expressions with live highlighting, capture groups, replacement preview, and a built-in cheatsheet.
The / characters are visual only — type the raw pattern (e.g. foo/bar, not escaped slashes).
✓ Valid regex
Advanced
—
Invalid regex
Type a regex pattern above to see matches
Regex Cheatsheet
Character classes
| Any char except newline | |
| Digit | |
| Non-digit | |
| Word character | |
| Whitespace | |
| Any of a, b, c | |
| Not a, b, or c | |
| Lowercase letters |
Anchors
| Start (line with m) | |
| End (line with m) | |
| Word boundary | |
| Non-word boundary |
Quantifiers
| 0 or more | |
| 1 or more | |
| 0 or 1 | |
| Exactly 3 | |
| Lazy * |
Groups
| Capture group | |
| Non-capturing | |
| Named group | |
| OR |
Common patterns
Try an example
How to use the Regex Tester
Four steps to debug patterns in your browser.
- 1
Enter your pattern
Type the raw pattern between the decorative slashes. Toggle flags (g, i, m, s, u, y) on the right.
- 2
Paste a test string
Add sample text in the left panel. Matches highlight live as you type.
- 3
Inspect results
See match count, positions, numbered groups, and named groups in the results panel.
- 4
Try replacement (optional)
Enable Find & Replace, enter $1-style replacement, preview result or diff, then copy.
What is a regex tester?
A regular expression (regex) is a compact language for describing text patterns — emails, dates, URLs, log formats, or validation rules in forms. Regex is powerful but cryptic; a single misplaced quantifier can match everything or nothing. A regex tester lets you edit a pattern and see matches highlighted instantly, which is essential before shipping code or cleaning data.
SuperTextTools runs JavaScript's native RegExp engine in your browser. Results match what you get in Node.js and modern browsers — including named capture groups, lookbehind, lookahead, and Unicode property escapes when the u flag is on.
What this tool does
- Live match highlighting with an overlay synchronized to your test string
- Flag toggles: global, case-insensitive, multiline, dotall, unicode, sticky
- Per-match cards with positions, numbered groups, and named groups
- Optional find-and-replace preview with result and diff views
- Clickable cheatsheet patterns inserted into the editor
Common use cases
- Form validation — email, phone, postal codes
- Extracting fields from logs, JSON strings, or scraped HTML
- Search-and-replace in editors and IDEs
- URL routing rules in web frameworks
- Linters, static analysis, and code mods
- Data cleaning and one-off ETL in spreadsheets exported to text
Tips for writing good regex
- Start broad, then narrow with tests on edge cases (empty input, unicode, very long lines)
- Use non-capturing
(?:...)when you do not need the captured value - Anchor with
^and$when matching whole strings - Prefer lazy quantifiers (
*?) when matching delimited segments - Watch for catastrophic backtracking on nested quantifiers — refine patterns that stall on long inputs
Performance and safety
Match iteration stops after 100,000 results to prevent freezes. Test strings with HTML or script tags are escaped in the highlight layer so nothing executes. Large inputs use debounced updates (100ms) to keep typing responsive.
Frequently asked questions
Why are my matches not showing without the "g" flag?
What's the difference between greedy and lazy quantifiers?
* takes as much as possible. Lazy (add ?): *? takes as little as possible. On <a><b>, <.+> matches the whole string; <.+?> matches each tag separately.Does this support lookbehind and lookahead?
(?<=foo) lookbehind and (?=bar) lookahead. Results match Node.js and current browsers.Can I save my regex patterns?
What's "catastrophic backtracking"?
(a+)+ can make the engine try exponentially many paths on certain inputs. We cap at 100,000 matches and show execution time on large inputs to reduce freezes.Can I use this for Python or PCRE regex?
RegExp engine. Most patterns transfer, but flavors differ. For Python-specific syntax, use a flavor-specific tester; for JS/Node/browser code, this is the right baseline.Related tools
More free tools — all run in your browser.
Find & Replace
Find and replace text with support for regex and case sensitivity.
JSON Formatter
Format, validate, and minify JSON instantly.
Diff Checker
Compare two texts side-by-side and see exactly what changed.
URL Encoder
Encode and decode URL components safely.
Slug Generator
Generate URL-friendly slugs from any text.
Word Counter
Count words, characters, sentences, and reading time.