About Regex Tester
Regex Tester is a browser-based tool for writing, debugging, and validating JavaScript regular expressions. Type a pattern and a test string β matches are highlighted live, capture groups are broken out per match, and a substitution box lets you preview what a .replace() call would produce. Twelve+ preset patterns cover the most common needs (email, URL, IPv4/IPv6, hex color, ISO date, phone, UUID, semver, credit card, and more).
The engine is your browser's native JavaScript regex β the exact same engine that runs your app. No dialect surprises, no server round-trip, no signup. Everything happens client-side.
Uses JavaScript's regex flavor. Most patterns work across languages, but details differ β PCRE (PHP), Python re, Java, and .NET have small variations in named groups, lookbehind support, and escape semantics. Test in your target language before deploying.
How to use
Type your pattern
Enter the regex in the top box. Toggle flags with the letter buttons (g, i, m, s, u, y).
Paste your test string
The text panel is your test corpus. Matches highlight in real time with a subtle purple background.
Inspect groups
The right panel shows every match with its position and any capture groups (named or numbered).
Test substitution
Type a replacement pattern β $1, $<name>, $& work β and see the output.
Key Features
Live highlighting
Match highlights update every keystroke via an overlaid DOM. No "Run" button, no lag β just type.
Flag toggle buttons
Click g i m s u y to enable each. Tooltips explain what each flag does. Sticky y is included for anchored parsing.
Match list with groups
Each match shows index, character position, and every capture group β named groups keyed by name, positional groups by $1, $2, etc.
Substitution preview
Type a replacement string. Standard back-references work: $1-$99, $<name>, $& (whole match), $` (before), $' (after), $$ (literal $).
12+ preset patterns
Email, URL, IPv4, IPv6, hex color, phone (E.164), ISO 8601 date, credit card (basic), UUID, semver, US postal code, HTML tag, JSON string. One-click to load pattern + suitable test string.
Escape input helper
Click "Escape input" to turn the current pattern box into a literal string β useful when you want to match text that contains ., *, +, or other special chars.
Copy β pattern, JS literal, matches, replaced output
Grab the raw /pattern/flags, a JS-literal (new RegExp("...", "gi") equivalent), the list of match strings, or the substituted output.
Regex cheat sheet
Compact reference of quantifiers, character classes, anchors, groups, and lookarounds right on the page.
Common Use Cases
- Writing a validator for email / URL / phone input
- Extracting all links from a chunk of HTML
- Building a log-line parser for CI or observability
- Cleaning up user data β remove ANSI codes, control chars, extra whitespace
- Grepping through a large text sample before writing the real script
- Testing capture groups before dropping them into
.match()or.matchAll() - Debugging why your regex isn't matching what you expected
- Learning regex through preset patterns
- Prototyping a find-and-replace transformation
- Verifying complex patterns from Stack Overflow before pasting into production
Security & Privacy
- 100% client-side: pattern + test string never leave your device.
- Works offline: disconnect after page load and it still works.
- Catastrophic backtracking safeguard: patterns run in your browser's regex engine which may hang on pathological inputs. If you paste a suspicious pattern from the internet, use short test strings first.
- No account, no logging.