Regex Tester — Free Online Regular Expression Debugger
Paste a pattern and test string to see live match highlighting, capture groups, and match indices. Uses your browser's native JavaScript RegExp engine. Free, no signup, 100% client-side.
Live match testing
Matches recompute the moment you change the pattern, flags, or test string.
Inline highlighting
Every match is highlighted in place so you can see exactly what your pattern captures.
Group & index details
Read the match range, numbered $1 $2 groups, and named groups in a structured panel.
100% client-side
Runs on your browser's native RegExp engine. No pattern or text is ever uploaded.
Online Regex Tester for JavaScript Regular Expressions
A regex tester runs a pattern against test text and shows you every match, capture group, and match position as you type. This one calls your browser's native JavaScript RegExp engine, so results match exactly what your app will see in production. Toggle the g, m, i, s, and u flags, inspect numbered and named groups, and read match indices — free, with no signup and nothing uploaded.
How to test a regular expression
Build and debug a pattern in five steps. Everything updates live as you change the pattern, flags, or test string.
- Type your pattern in the field between the two
/delimiters — no need to escape the slashes or wrap them yourself. - Toggle the flag pills you need. The default is
gm(global + multiline); click any pill to add or remove it. - Paste or edit the test string below. Every match is highlighted inline and counted in the Match Information panel.
- Open a match to read its index range
[start-end]and any capture groups, shown as$1,$2, with named groups labeled. - Fix the pattern until the highlights and group values are exactly what you expect, then copy it into your code.
Common regex patterns to copy
Paste any of these into the pattern field to start. Each is written for the JavaScript engine; treat the email and phone patterns as format checks, not strict standards validation.
Email shape
^[^\s@]+@[^\s@]+\.[^\s@]+$Checks the basic name@domain.tld shape, not full RFC 5322 validity.
HTTP/HTTPS URL
^https?:\/\/[^\s$.?#].[^\s]*$Matches links beginning with http:// or https://.
Phone number
^\+?[\d\s-]{10,15}$Optional + prefix, 10–15 digits, spaces, or dashes.
ISO date (named groups)
(?<y>\d{4})-(?<m>\d{2})-(?<d>\d{2})Captures year, month, and day by name.
What is a regular expression and how does this work?
A regular expression is a compact language for describing patterns in text. The browser compiles your pattern with new RegExp(pattern, flags) and runs it against the test string — the same call your own JavaScript uses. This tool follows the JavaScript flavor defined in the ECMAScript RegExp specification, with per-feature behavior documented on MDN's RegExp reference.
Because the engine is JavaScript-specific, a few habits from other flavors do not carry over: there are no possessive quantifiers (a++) and no atomic groups. Modern ES2018 features do work here: named groups (?<name>...), lookbehind (?<=...) and (?<!...), and Unicode property escapes such as \p{L} when the u flag is on.
Worked examples
1. Capture PascalCase words (the default demo)
Pattern ([A-Z])\w+ with flags gm against PascalCase words like FunctionNames matches PascalCase, FunctionNames, and group $1 holds the leading capital (P, F).
2. Multiline anchors
Pattern ^\w+ on three lines returns one match per line with the m flag on. Remove m and you get a single match — the first word of the whole string only.
3. Edge case: the dot does not cross newlines
Pattern a.b against a\nb returns no match, because . excludes newlines by default. Add the s (dotAll) flag and it matches.
4. Failing literal: catastrophic backtracking
Pattern (a+)+$ against aaaaaaaaaaaaaaaaaaaaaaaaaaab can hang the tab. The nested quantifier forces the engine to try exponentially many splits before it gives up. Rewrite it as a+$.
JavaScript regex flag reference
The five flags below are exposed as toggle pills; the default state is gm. The y (sticky), d (hasIndices), and v (unicodeSets) flags exist in the spec but are not toggled here. Note that u and v are mutually exclusive and cannot be combined.
| Flag | Name | What it changes |
|---|---|---|
| g | global | Find all matches instead of stopping after the first. |
| m | multiline | ^ and $ match the start/end of each line, not just the whole string. |
| i | ignoreCase | Casing differences are ignored when matching. |
| s | dotAll | Lets . match newline characters too. |
| u | unicode | Treats the pattern as Unicode code points; enables \p{...} escapes. |
Common token cheat sheet
| Token | Description | Example Matches |
|---|---|---|
| . | Any character (except newline) | a, 1, % |
| \w | Word character | a-z, A-Z, 0-9, _ |
| \d | Digit | 0-9 |
| [abc] | Character set (a, b, or c) | a, b, or c |
| (?:...) | Non-capturing group (no $n slot) | groups without capturing |
| + | One or more quantifier | "a" or "aaaa" |
The 10,000-match guard most testers skip
With the g flag on, this tester stops collecting after 10,000 matches and tells you it hit the cap, instead of freezing while a zero-width or pathological pattern loops forever. It also auto-advances lastIndex past zero-width matches (like (?:) or \b) so the loop cannot stall on an empty match — a classic bug in naive while (regex.exec(...)) code. What it cannot stop is catastrophic backtracking: the native engine has no backtrack budget, so a pattern like (a+)+$ on a long non-matching string can lock the tab. That failure mode is the root of most real-world ReDoS incidents — flatten nested quantifiers before you ship a pattern to a server.
Runs 100% in your browser
Your pattern and test text never leave your device. The match runs on your browser's native RegExp engine with no network call, no upload, and no logging — you can switch off your connection and it still works. I tested it against the demo PascalCase pattern, multiline anchors, named-group ISO dates, and a deliberate (a+)+$ backtracking case to confirm the highlighting, group panel, and 10,000-match cap behave exactly as documented above.
Related developer & text tools
Apply a tested pattern as a substitution
Diff CheckerCompare two strings line by line
Text SorterSort and dedupe matched lines
Case ConverterSwitch captured text between cases
JSON FormatterValidate data you extracted with regex
URL ParserBreak a URL into its parts
HTML Entity ConverterEncode/decode scraped markup
Word CounterCount words, characters, and lines
URL Slug GeneratorSlugify strings with clean rules
Cron Expression BuilderBuild schedules with field syntax
New to pattern syntax? Read the guides on the Toolk blog for a full regex cheat sheet and worked walkthroughs.
Last updated: June 2, 2026. Verified against the ECMAScript RegExp specification and the live tool above.
Need a different tool?
Browse all 89 free, in-browser tools — or tell us what we should build next.