text
Regex tester
Test a regular expression with live match highlighting and capture groups.
Runs 100% in your browser. Nothing you paste is uploaded, stored, or sent to a server.
Highlighted matches
How to use
- Enter a pattern using JavaScript / ECMAScript syntax. You do not need the wrapping slashes.
- Toggle flags: g (global), i (ignore case), m (multiline), s (dotAll), u (unicode), y (sticky), d (indices).
- Paste a sample string. Matches highlight in place; the list below shows offsets, full text, and groups.
- Copy a working pattern into your editor. If the pattern is invalid, the error from the engine is shown as-is.
A regex that looks right on one sample can still miss the next. This tester runs the same ECMAScript engine your browser uses for String.prototype.match, so the highlights you see are the highlights you will get in JavaScript, TypeScript, and most front-end stacks.
Use it to debug an email or URL pattern, to inspect named groups before you drop them into a parser, or to see whether you forgot the global flag. The pattern and the corpus stay on the device — useful when the test string is a production log line or a customer email.
Examples
Simple token
Pattern \w+ against “hello-world 42” yields hello, world, and 42 when the global flag is on. Without g, only the first token is returned.
Named groups
(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) against 2026-10-19 fills year, month, and day. Named groups show up beside the numbered ones.
Invalid pattern
An unclosed parenthesis such as (foo is reported immediately. Fix the syntax before you trust a “no matches” result.
JavaScript flavor notes
DeskKit uses the RegExp constructor in your browser. That means lookbehind, named groups, and Unicode property escapes (\p{L}) work when the engine supports them — modern Chromium, Firefox, and Safari all do. It also means POSIX classes such as [[:digit:]] and PCRE verbs like (*SKIP) will not compile.
The tester always walks matches with exec so empty matches (for example, a* against “bbb”) cannot spin forever. If you paste a very large corpus, results are capped so the tab stays responsive.
Looking for a starting point? The regex library on this site has dedicated pages for email, URL, IPv4, UUID, and other high-traffic patterns, each with a pre-filled tester.
FAQ
Is this PCRE, Python, or JavaScript regex?
JavaScript / ECMAScript, because that is what the browser can run without a server. Python’s re and PCRE differ on lookbehind, possessive quantifiers, and some escapes. Treat this as a JS tester.
Why did I only get one match?
The global flag is off. Enable g to collect every non-overlapping match. Sticky (y) is a different contract: it only matches at lastIndex.
Can I test against a file?
Paste the file contents into the sample box. Nothing is uploaded, so a few megabytes of text is fine; tens of megabytes will slow the tab down.
Does the tester send my pattern anywhere?
No. Compilation and matching happen locally. There is no share URL and no request payload.