01What is Regex Tester?
Regex Tester lets you try a regular expression against real text and see every match before the pattern goes into your code. It doesn't ship its own regex engine. Your pattern goes straight into the browser's built-in JavaScript RegExp, so the results are exactly what JavaScript in that browser would give you. The syntax and flags follow the ECMAScript language specification, the same rules documented on MDN. You type a pattern in the Regular Expression field and some text in the Test String box. Matches light up in the Highlighted Matches panel on every keystroke. Below that, Match Details lists each match with its start index, its length, its numbered capture groups ($1, $2 and so on) and any named groups written as (?<name>...). The flag buttons cover the JavaScript flags your browser supports. That means g (global), i (ignore case), m (multiline anchors), s (dotAll), u (Unicode), y (sticky) and d (indices). The d flag adds the start and end position of every capture group to the table. The v flag from ES2024, which allows set operations such as [\p{L}--[a-z]], only shows up if your browser understands it. Since JavaScript refuses to combine u and v, turning one on switches the other off. Here is a quick example. The pattern (?<y>\d{4})-(?<m>\d{2}) with the g flag, run on "Due 2024-03, paid 2024-04", gives two matches. The first is "2024-03" at index 4 with y=2024 and m=03. The second is "2024-04" at index 18. Drop the g flag and you only get the first one, because exec stops after a single match. A few details come from the code itself. When a pattern can match an empty string, like a*, the tester moves one position forward after each empty match so the loop can't spin forever. With u or v on, that step skips a whole emoji or other surrogate pair instead of landing in the middle of it. Indexes and lengths count UTF-16 code units, which is how JavaScript counts. A global search stops after 10,000 matches. The Common Patterns menu loads starters for email, URL, IPv4, IPv6, US phone, dates, times, hex colours, UUIDs and HTML tags. Copy puts the pattern on your clipboard as a /pattern/flags literal. The limits are real. The tool doesn't explain a pattern in words. PCRE, Python and Go use different syntax in places, so a pattern that passes here may still fail there. And because matching runs on the page itself, a pattern with catastrophic backtracking can freeze the tab.
JavaScript and TypeScript developers who want to see exactly what a RegExp will match, with its groups and positions, before putting it into validation, parsing or replace code. The tool runs entirely in your browser, so your data never leaves your device.
02How to use Regex Tester
- Type your pattern in the Regular Expression field, or pick a starter from Common Patterns.
- Turn on the flags you need, for example g for all matches, i to ignore case or m for per-line anchors.
- Paste your sample text into the Test String box.
- Read the Highlighted Matches panel, then check Match Details for indexes and capture groups.
- Adjust the pattern until the matches look right, then press Copy to take it as a /pattern/flags literal.
03Worked examples
- Input:
Pattern (?<y>\d{4})-(?<m>\d{2}), flag g, text "Due 2024-03, paid 2024-04" - Result:
2 matches: "2024-03" at index 4 (y=2024, m=03), "2024-04" at index 18 (y=2024, m=04) - Named groups are listed by name and also as $1 and $2.
- Input:
Pattern \d+, no flags, text "a1 b22 c333" - Result:
1 match: "1" at index 1 - Without g, exec returns only the first match.
- Input:
Pattern ^\w+, flag g vs flags gm, text "one\ntwo\nthree" - Result:
g: 1 match ("one"). gm: 3 matches ("one" at 0, "two" at 4, "three" at 8) - Without m, ^ only matches at the very start of the whole text.
- Input:
Pattern <.+> vs <.+?>, flag g, text "<b>x</b>" - Result:
<.+>: 1 match "<b>x</b>". <.+?>: 2 matches "<b>" at 0 and "</b>" at 4 - + is greedy and runs to the last >, while +? stops at the first one.
- Input:
Pattern a*, flag g, text "baa" - Result:
3 matches: "" at 0, "aa" at 1, "" at 3 - Empty matches are real results. The tester steps past each one so the search ends.
- Input:
Pattern (abc, no flags - Result:
Invalid regular expression: /(abc/: Unterminated group - Wording from Chrome's V8 engine. Other browsers phrase the error differently.
04Common use cases
- Checking a form validation pattern against a list of good and bad email addresses before it ships
- Pulling timestamps and log levels out of a few sample server log lines with named groups
- Confirming which groups a String.replace call will see as $1 and $2 before you write the replacement
- Finding out why ^ only matches the first line of a multi-line string (you forgot the m flag)
- Testing a Unicode property escape like \p{L} with the u or v flag on accented names
- Debugging a greedy pattern that swallows too much, such as <.+> eating a whole HTML snippet
05Tips
- Matching runs on the page, so a pattern with nested quantifiers like (a+)+ can lock up the tab. Try risky patterns on a short string first.
- Turn on d when you need the exact start and end of each capture group, for example to highlight parts of a string in your own UI.
- Prefer a lazy .*? or a negated class like [^>]* over .* when you want the match to stop at the first delimiter.
- Paste the error text into a search if your pattern fails here. The message comes straight from the browser's engine, so it names the exact problem.
- Indexes are in UTF-16 code units, so an emoji counts as 2. Keep that in mind if you slice the string in another language.
06Related concepts
PCRE, ECMAScript regex, Capture groups, Lookahead assertions.
Frequently Asked Questions
What is Regex Tester?
Regex Tester is a free, browser-based developer tool on AIDToolStack. Test and debug JavaScript regular expressions with real-time match highlighting, capture groups and every JS flag. It requires no installation or sign-up and works entirely in your browser.
Is Regex Tester free to use?
Yes. No sign-up, no fees and no usage cap.
Does Regex Tester store my data?
No. It runs in your browser; nothing is uploaded.
Video
From our YouTube channel. The player loads from YouTube only when you press play.
Cheat sheet
- awk Cheat Sheet: Fields, Patterns, Arrays and One-Liners
- grep and ripgrep Cheat Sheet: Flags, Regex Flavours and Ignore Rules
- .htaccess Cheat Sheet: Redirects, RewriteRule, Headers and Access
- HTML Elements Cheat Sheet: Forms, Meta Tags, Images and Dialog
- JSON Schema Cheat Sheet: Draft 2020-12 Keywords with Examples
- Regex Cheat Sheet: JavaScript, Python and PCRE2 Syntax Side by Side
- sed Cheat Sheet: Substitution, Addresses, In-Place Edits and Hold Space
- Zed Cheat Sheet: Agent Panel, Settings, Key Bindings and MCP