How to use this regex tester
- Type your pattern in the top field — just the body, no surrounding slashes. For example,
\b\w+@\w+\.\w+\bto find simple email-like strings. - Pick your flags with the checkboxes:
gfinds every match (not just the first),iignores letter case,mmakes^and$match at every line, andslets.match newlines too. - Paste your test text into the box below. Matching runs instantly on every keystroke — no button to press.
- Read the results: the Matches counter shows how many were found, and each match is listed with its position and any capture groups.
- Copy all matched substrings to your clipboard, or Clear to start fresh.
A quick refresher on regular expressions
A regular expression (regex) is a tiny pattern language for describing text. Plain characters match themselves, while special tokens describe shapes: \d is any digit, \w a word character, \s whitespace, and . any character. Quantifiers say how many — * (zero or more), + (one or more),? (optional) and 4 (a range). Brackets like [a-z] define a character set, and parentheses (...) create a capture group so you can pull out just the part you care about.
This tool uses the JavaScript regex engine built into your browser, so what you see here is exactly whatString.prototype.match and RegExp.prototype.exec will do in your own JavaScript or Node.js code — including how capture groups, named groups (?<year>\d4) and the global flag behave. That makes it a faithful scratchpad for front-end and back-end developers alike.
Capture groups and match positions
Every result shows the full match plus its index (the zero-based character position where it starts). If your pattern contains parentheses, each capture group is listed beneath the match in order, andnamed groups are shown by name. A group that did not participate in the match appears asundefined — useful for spotting optional branches that did or did not fire. With the g flag off, only the first match is returned, mirroring how a non-global exec behaves.
Is it private?
Yes — completely. Your pattern, your flags and your test text are compiled and matched locally in your browser with built-in JavaScript. There is no network request, no logging and nothing is uploaded to ToolFern or anywhere else. You can disconnect from the internet and this tester keeps working, which matters when you are debugging patterns against logs, customer data or anything else you would rather not paste into a remote server.
Frequently asked questions
Do I include the slashes, like /abc/g?
No. Type only the pattern body (abc) in the pattern field and set the flags with the checkboxes. Adding literal slashes would make them part of the pattern.
My pattern matches forever or is slow — why?
Some patterns (often nested quantifiers like (a+)+) can cause catastrophic backtracking on certain inputs. Simplify the pattern or anchor it. Zero-width matches are handled safely here so the tool will not loop infinitely.
Does it support named capture groups and lookbehind?
Yes — it runs the modern browser regex engine, so named groups (?<name>…), lookahead and lookbehind all work in any up-to-date browser.
Is anything I paste sent to a server?
Never. All matching happens in your browser; your data is not uploaded.