Regex Tester Online — 40+ Presets, Multi-Language
Free regex tester online — paste a regex, get live match highlighting plus code for 10 languages (JS, Python, Go, Java, Ruby). 40+ pattern presets.
Match details (5)
| # | Match | Index | Groups |
|---|---|---|---|
| 1 | alice@example.com | 8 | — |
| 2 | bob@test.co.uk | 29 | — |
| 3 | support@pdfflare.com | 67 | — |
| 4 | charlie@sub.domain.io | 128 | — |
| 5 | dave+spam@gmail.com | 151 | — |
const re = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
const matches = "your text".match(re) ?? [];Pattern library — 40+ presets
Web / URL
Phone
Date / Time
Network
IDs
Financial
Postal
US Gov IDs
Code / Markup
Numbers
Strings
What does this regex mean?
- [a-zA-Z0-9._%+-] — character class
- + — one or more of previous
- "@" — literal text
- [a-zA-Z0-9.-] — character class
- + — one or more of previous
- \. — literal "."
- [a-zA-Z] — character class
- {2,} — quantifier (exact / range)
Regex cheat sheet
Character classes
\d— digit (0-9)\w— word char (a-z, 0-9, _)\s— whitespace.— any char (except newline)[abc]— a, b, or c[^abc]— NOT a, b, or c
Anchors & boundaries
^— start of string$— end of string\b— word boundary\B— NOT word boundary
Quantifiers
*— 0 or more+— 1 or more?— 0 or 1{n}— exactly n{n,m}— n to m*?— lazy (non-greedy)
Groups & lookarounds
(abc)— capture group(?:abc)— non-capturing(?<n>abc)— named group(?=abc)— positive lookahead(?!abc)— negative lookaheada|b— alternation
PDFFlare's regex tester online is a free, browser-based tool for testing, debugging, and porting regex patterns. Drop in a pattern, see live match highlighting on your test string, get capture groups inspected in a table, and copy paste-ready code for 10 languages — JavaScript, TypeScript, Python, Java, Go, PHP, Ruby, C#, Rust, and Bash. The pattern library covers 40+ common patterns (email, URL, phone, IPv4, UUID, credit card, hex color, semver, JWT) so you don't have to write the common ones from memory. If you have data but no regex, jump to PDFFlare's Regex Generator first to infer a pattern from sample strings, then come back to test it.
Use it as a JavaScript regex tester for everyday match debugging, a regex match online for log file extraction, or a regex101 alternative that ships ad-free with code output for more languages. Pairs with PDFFlare's JWT Decoder (regex on JWT tokens often catches malformed signatures), the JSON Formatter (pretty-print before regex-extracting fields), and the UUID Generator for IDs you may want to validate with regex.
Acts as a regex pattern library for the patterns you hit weekly, a multi-language regex converter for porting regex between codebases, and a built-in regex cheat sheet for character classes, quantifiers, and lookarounds. Free, unlimited, no upload, no rate limits.
How to Test a Regex
Pick a preset or paste your regex
Open the pattern library and click any of 40+ battle-tested presets — email, URL, phone, IPv4, UUID, credit card, hex color, JWT, semver, and more. Or paste your own regex. The tester accepts JavaScript-flavor regex (with named groups, lookaheads, lookbehinds where supported).
Toggle flags as needed
Click the g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), y (sticky) flag chips. They update the regex literal display and re-run the match instantly. Hover any flag for a one-line description.
Read live match highlights and capture groups
Type or paste your test string and PDFFlare highlights every match in orange. The match details table below shows index, full match, and each capture group (with $1, $2, $3 labels). Empty matches and zero-width assertions are surfaced too.
Copy code for your language
Pick a target language from the Code snippet dropdown — JavaScript, TypeScript, Python, Java, Go, PHP, Ruby, C#, Rust, or Bash (grep -E). PDFFlare emits paste-ready code with proper escaping and the right flags translated for that language's regex API. Copy and drop into your codebase.
When Do You Need a Regex Tester Online?
Validating user input on a form: Email field, phone field, ZIP code, postal code, credit card. Open the pattern library, copy the right preset, paste into your validation library, done. PDFFlare ships honest patterns — the simple email regex catches 99% of real addresses, not the 500-character RFC 5322 monster that rejects valid edge cases.
Extracting fields from log files or text dumps: You have a 50 MB log dump and need every IPv4 address, every UUID, or every error stack trace header. Paste a sample, pick the right preset, copy the code snippet for your language, run it on the real file. Pair with the live match-count badge to gut-check whether the regex is matching too much or too little before committing to it.
Converting a regex from one language to another: You wrote it in JavaScript, your colleague needs it in Python or Go. PDFFlare emits paste-ready code in 10 languages with the right flag translation (re.IGNORECASE, Pattern.MULTILINE, inline (?i) flags) and the right escape rules. Saves the copy-paste-edit-debug cycle every time you port a regex.
Debugging a regex that's misbehaving in production: Your regex matches in tests but explodes in production logs. Often it's ReDoS (catastrophic backtracking) — the regex worked on benign input but a crafted string triggers exponential evaluation. PDFFlare's ReDoS detector flags nested-quantifier patterns ((a+)+, (a|aa)+) with a red warning. Pair with the substitution preview to see what the regex actually consumes.
Why Use PDFFlare's Regex Tester Online?
40+ Battle-Tested Pattern Presets
Email (simple + RFC 5322 lite), URL (with/without protocol), phone (US/UK/E.164), date (ISO/US/EU), IPv4, IPv6, MAC, UUID v4/any, JWT, ULID, credit card, currency, IBAN, postal codes, SSN, HTML tag, Markdown link, hex color, semver, file extension, and more. Categorized so you can browse by intent.
Multi-Language Code Output (10 Languages)
Paste-ready snippets for JavaScript, TypeScript, Python, Java, Go, PHP, Ruby, C#, Rust, and Bash (grep -E). Each snippet uses the right escape rules and translates flags (g/i/m/s) to the destination language's regex API. Drop straight into your codebase.
100% Browser-Based
Native JavaScript RegExp engine. No upload, no server, no logs. Open DevTools → Network and you'll see zero requests while testing. Safe for confidential test strings (logs with PII, internal data, prod samples).
No Signup Required
Free, unlimited, no account, no rate limits, no ads. Substitution mode, capture-group inspector, ReDoS detector, plain-English explanation pane, regex cheat sheet, recent-patterns history — all client-side, all included.
Frequently Asked Questions About Regex Generator and Tester
Paste your regex pattern into PDFFlare's regex generator and tester, type or paste a test string below it, and PDFFlare highlights every match in real time. The match details table shows capture groups, named groups, and byte offsets. Toggle flags (g, i, m, s, u, y) by clicking the flag chips. Free, browser-based, no signup, no upload — your test strings never leave your machine.
Same general idea — paste regex, see matches. PDFFlare's tester adds: 40+ pre-built pattern presets (email, URL, phone, IPv4, UUID, credit card, etc.) so you don't have to write common patterns from scratch; multi-language code output with paste-ready snippets for 10 languages (JS, TS, Python, Java, Go, PHP, Ruby, C#, Rust, Bash); ReDoS detector that flags catastrophic-backtracking patterns; substitution mode with $1 backreferences; no ads; no signup; runs offline after page load. regex101 is excellent for deep-diving on a single regex; PDFFlare's version is built for getting working regex into your codebase faster.
JavaScript regex (ECMAScript). That means: (?<name>...) named capture groups, (?=...) lookaheads, (?<=...) lookbehinds (Node 10+/modern browsers), \u{NNNN} unicode escapes (with the u flag), and Unicode property escapes \p{...} (with u flag). It does NOT support: POSIX character classes ([[:alpha:]]), atomic groups, possessive quantifiers, or recursive patterns — those are PCRE/Perl extensions. The code-snippet output translates the pattern into your target language's regex syntax where they match cleanly; complex patterns may need adjustment when porting to Python/Java/.NET.
Open the pattern library, scroll to the Email category, and pick 'Email (simple)' — it covers 99% of real addresses with [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. For stricter RFC 5322 compliance, use 'Email (RFC 5322 lite)'. Honest answer: a perfect RFC 5322 regex is hundreds of characters long and almost never worth it — the simple version catches every email a human would actually type. The strict ones reject valid edge-case addresses (single-char TLDs, quoted local parts) more often than they catch invalid ones.
ReDoS happens when an attacker sends input that triggers exponential backtracking in your regex. Classic dangerous patterns: nested quantifiers like (a+)+, alternation overlap like (a|aa)+, and any quantifier inside a group with a quantifier outside. PDFFlare's tester runs a heuristic detector and shows a red ReDoS warning when it spots one of these shapes. Mitigation: rewrite to use possessive quantifiers (in PCRE), atomic groups, or (in JS) refactor to avoid the nested quantifier — usually you can replace (\w+)+ with \w+ and get the same behavior without the pathology.
Yes — PDFFlare emits paste-ready code snippets for 10 languages: JavaScript, TypeScript, Python (re module), Java (Pattern/Matcher), Go (regexp), PHP (preg_match_all), Ruby, C# (System.Text.RegularExpressions), Rust (regex crate), and Bash (grep -E). Each snippet uses the correct escape rules and flag translation for that language. Caveat: the regex pattern is tested with JavaScript's regex engine. Most patterns translate cleanly to Python/Java/etc., but if you use JS-specific features like \p{...} unicode property escapes or named groups, double-check the destination language supports them.
Five common causes. (1) Missing the g (global) flag — without it, only the first match is returned. (2) Anchors ^ and $ match start/end of string by default; add the m flag to make them match line boundaries. (3) The . metacharacter doesn't match newlines unless you add the s (dotAll) flag. (4) Greedy vs lazy: .+ is greedy and will gobble up too much; .+? is lazy and stops at the first match. (5) Forgot to escape a special character — to match a literal dot, write \\. not . in your pattern. PDFFlare's match-count badge shows zero, and the explanation pane breaks down each token so you can spot the issue.
Toggle 'Substitution mode' under the test string. The tester replaces every match (or just the first if g flag is off) with your replacement string. Use $1, $2, $3 to insert capture groups in the replacement: pattern (\w+)@(\w+) with replacement $2-$1 transforms 'alice@gmail' to 'gmail-alice'. Named groups work too: $<name>. PDFFlare shows a live preview as you type — copy the result with the Copy button. Useful for cleaning up exported data, batch-renaming variables in code, or anonymizing logs (regex on emails, replace with [REDACTED]).
Yes — once the page loads, all regex parsing, matching, substitution, and code-snippet generation run entirely in your browser via the native JavaScript RegExp engine. No network requests are made during testing. Open DevTools → Network and you'll see zero traffic while you type or change flags. Safe for testing regex against confidential strings (logs with PII, internal data, production samples) — nothing is uploaded.
PDFFlare automatically saves the last 10 regex patterns you tested in your browser's localStorage — they appear in the 'Recent patterns' list at the bottom of the tool. Click any to reload it instantly. Your test strings are NEVER saved (they may contain PII or proprietary data). If you want to keep a regex permanently, copy the code snippet for your target language and paste into your codebase — the regex itself is the source of truth, not the tester state.