Regex Tester
Test regular expressions against text with live match highlighting.
Regex Tester — Build and debug JavaScript regular expressions with instant feedback: matches are highlighted in the test string as you type, capture groups are listed per match, and all six flags (g, i, m, s, u, y) can be toggled with one click. Zero-length and overlapping edge cases are handled safely, and nothing you test ever leaves your browser.
What is Regex Tester?
The Regex Tester is a free online regular expression tester and debugger that runs a JavaScript regex pattern against sample text and highlights every match live as you type. Developers, data wranglers, and anyone writing search-and-replace or validation rules use it to build and debug patterns, inspect capture groups, and see how flags change matching. Enter a pattern between the slashes, toggle the g, i, m, s, u, and y flags, paste a test string, and instantly view the match count, highlighted matches, and per-match capture group values. Because it uses the browser-native RegExp engine, results behave exactly as they will in your JavaScript code.
How to use Regex Tester
- Type your regular expression into the Regular expression field shown between the slash delimiters.
- Toggle the flags you need under Flags: g global, i ignore case, m multiline, s dotAll, u unicode, or y sticky; g is on by default. Active flags appear after the closing slash next to your pattern.
- Paste or type your sample text into the Test string box, or click Clear to empty it.
- Read the Matches count and review the Highlighted panel, where every match is highlighted inline within the test string.
- Check the Match details list to see each match's position index, the matched value, and the value of every numbered capture group.
Examples
Find all numbers
Input
pattern \d+ (digit class, flag g) on text a1b22c333
Output
Matches: 3 (highlights 1, 22, 333)
Match a word case-insensitively
Input
pattern Hello (flags i and g) on text hello HELLO Hello
Output
Matches: 3 (highlights hello, HELLO, Hello)
Capture groups from a date
Enter a pattern with three parenthesized digit groups separated by hyphens, such as (\d+)-(\d+)-(\d+), against 2026-06-17 to get one match whose group 1, group 2, and group 3 show 2026, 06, and 17 in Match details.
Frequently asked questions
- Which regex flags are supported?
- All six JavaScript flags: g (global), i (ignore case), m (multiline), s (dotAll), u (unicode), and y (sticky). Click any flag toggle to switch it on or off; the active flags appear after the closing slash next to your pattern.
- What regex syntax does it use?
- It uses the browser-native JavaScript RegExp engine, so your pattern behaves exactly as it would in JavaScript or TypeScript code, including capture groups, character classes, lookarounds, and Unicode escapes when the u flag is on.
- Why does it say my expression is invalid?
- If the pattern cannot be compiled (for example an unbalanced bracket or an unknown escape), the tool shows the exact error message returned by the RegExp constructor instead of any matches. Fix the pattern and the matches update instantly.
- Does it show capture groups and match positions?
- Yes. Each match is listed in Match details with its starting index in the text, the matched value, and every numbered capture group; empty groups show (empty) and groups that did not participate show a dash.
- Is my pattern or test text uploaded anywhere?
- No. Everything runs 100% client-side in your browser using the native RegExp engine. Your pattern and test string are never sent to a server, so you can safely test against sensitive or private data.
Related tools
Base32 / Base58 Encode / Decode
Encode text to Base32 (RFC 4648) or Base58 (the Bitcoin alphabet) and decode either one back to text, fully UTF-8 safe and entirely in your browser.
Base64 Encode / Decode
Encode text to Base64 or decode Base64 back to text (UTF-8 safe).
Case Converter & Counter
Change text case and count characters, words and lines.
Code Formatter & Minifier
Beautify or minify HTML, CSS and JavaScript instantly in your browser, with 2-space, 4-space or tab indentation and Terser-powered JavaScript compression.