Pattern and test text never leave your browser.
What is a Regex Tester?
A regex (regular expression) tester lets you build and verify a pattern against sample text in real time, instead of the much slower trial-and-error loop of editing your application code, redeploying, and inspecting logs to see if a single pattern matched. Regex is the universal text-processing language — every modern programming environment supports some flavor of it, from JavaScript's RegExp and Python's re module to Java's Pattern, Go's regexp, ripgrep, grep, sed, awk, Vim search and most code editors' find-and-replace. The cost of getting a regex slightly wrong (skipping a needed escape, forgetting the g flag, using a greedy quantifier where lazy was needed) is exactly the cost of every bug it lets through: from malformed log parsers to over-eager validators to data-loss-grade replace operations. DevFormatLab's Regex Tester evaluates your pattern against the test text on every keystroke using the browser's native JavaScript RegExp engine, so the results you see are byte-identical to what your front-end code will produce. Every match is highlighted in the test text, each capture group (including named groups (?<name>...)) is listed side by side, and the standard flags g, i, m, s, u and y are all supported. A built-in preset library jump-starts the most common patterns (email addresses, URLs, Japanese postal codes, ISO 8601 dates, IPv4 addresses, hexadecimal colors) so you can iterate on a realistic baseline rather than starting from scratch. Compatibility notes flag the differences between JavaScript, Java and Python — for example, variable-length lookbehind, Unicode property escapes (\p{Nd}, \p{Script=Hiragana}), and the syntax for named groups — so you don't ship a pattern that works locally but breaks in your server runtime. Nothing is uploaded: the regex and the test text never leave your browser, which makes the tool safe for log lines, customer emails, and sensitive identifiers.
Features
- Real-time match highlighting as you type — no Run button needed
- Per-match capture group listing, including named groups (?<name>...)
- All standard flags: g (global), i (ignore case), m (multiline), s (dotAll), u (Unicode), y (sticky)
- Presets: email, URL, Japanese postal code, ISO 8601 date, IPv4, hex color
- Compatibility notes for JavaScript / Java / Python differences
- Match counter and 1-based index per hit
- Browser-only — pattern and test text never leave your device
How to use
- Enter a pattern in the regex input (without the surrounding slashes — type users\.\w+, not /users\.\w+/).
- Add flags as needed in the flags box: g for all matches (not just the first), i for case-insensitive, m so ^ and $ match each line, s so . spans newlines, u for full Unicode.
- Paste your test string in the right panel — or click a preset (Email, URL, Japanese postal code, etc.) to load a working pattern and sample text together.
- Matches are highlighted live in the test text; the Matches panel on the right lists each hit with its 1-based index and all capture groups, including named groups.
- If your pattern produces "Invalid regular expression", a tooltip explains the cause (nothing to repeat, unterminated group, invalid escape) so you can fix it without leaving the page.
- Check the compatibility notes before shipping: a pattern that works in JavaScript may behave differently in Java or Python — for example, variable-length lookbehind or Unicode property escapes.
Frequently Asked Questions
Why does my pattern only match the first occurrence?
▾
You forgot the global flag g. Without it, RegExp.exec / String.match return only the first hit. // wrong — finds "cat" once /cat/.test("cat cat cat") // right — iterate all matches "cat cat cat".match(/cat/g) // ["cat","cat","cat"] In this tester, type g in the flags box next to the pattern. The Matches panel on the right then lists every hit with its 1-based index.
Why do I get "Invalid regular expression: nothing to repeat"?
▾
A quantifier (* + ? {n}) needs something to repeat. Most common causes are unescaped metacharacters at the start of a group: /+1234/ ← + has no preceding token /(?:)+/ ← repeating an empty group /5{1,3+}/ ← stray + inside the quantifier Fix by escaping the literal: /\+1234/ matches "+1234". For phone-number style inputs, prefer /\+?\d{10,15}/.
How do I match across multiple lines?
▾
Two different problems, two different flags: • m (multiline): ^ and $ match the start / end of each line instead of the whole string. Use this for line-by-line patterns like /^ERROR/m. • s (dotAll): . matches \n as well. Use this when a single pattern should span line breaks, e.g. /<pre>(.*?)<\/pre>/s. In the tester, combine flags freely: gms is common for log scraping.
Why does \d not match Japanese / full-width digits?
▾
By default \d is ASCII-only — it matches 0-9 but not 0-9. Add the u (Unicode) flag and use a Unicode property escape: /[\d\p{Nd}]/gu // matches both 12 and 12 The tester accepts u; Java needs (?U) and Python needs the third-party regex package (not stdlib re) for full Unicode classes — the compatibility panel flags these differences.
Lookbehind doesn't work in Safari / older Node — what should I do?
▾
Variable-length lookbehind (?<=...) shipped in V8 / SpiderMonkey years ago but is unsupported in Safari < 16.4 and Node 8.x. If you must support those runtimes: • Replace lookbehind with a capture group: instead of /(?<=USD )\d+/, use /USD (\d+)/ and read match[1]. • Or wrap the RegExp construction in try/catch and fall back to a manual scan. DevFormatLab's tester runs on your current browser, so a failure here means production will fail too — switch to the capture-group form before shipping.
Is my pattern or test text sent to a server?
▾
No. The pattern is compiled with new RegExp(...) and executed against the test text entirely inside your tab. Open DevTools → Network and click Run — you will see zero requests. Patterns are not stored in localStorage by default either.
Related tools
Format, minify, validate and beautify JSON with inline error highlighting.
Compare two JSON documents side-by-side with line-level highlighting and key sorting.
Remove duplicates, empty rows, trim whitespace, convert UTF-8 ↔ Shift-JIS.
Convert YAML ↔ JSON and YAML ↔ Java .properties with strict validation.
Encode and decode Base64 (and Base64URL) for text or files. Real-time, browser-only.
Encode and decode URLs, query strings and URI components with percent-encoding and form-style spaces.
Generate MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes for text or files in your browser.
Convert Unix timestamps (seconds or milliseconds) to and from human-readable dates across timezones.
Decode JSON Web Tokens to inspect header, payload and signature, with readable timestamps and expiry status.
Escape JSON into a string literal suitable for embedding into source code (double quotes and backslashes escaped).
Canonical: https://devformatlab.com/en/regex-tester