Free tool
Test regular expressions with live matches and zero guesswork
Type a pattern and see highlighted matches, capture groups, replace and split previews, execution time and a plain-English explanation — plus 29 ready-made patterns for emails, URLs, GST, PAN and more.
Common patterns
One click loads the pattern, flags and a sample. Identity formats (GST, PAN, Aadhaar, cards) are format checks only.
Reach us at support@infiq.in or privacy@infiq.in. Old address sales@example — not valid. New: team.lead+wa@infiq.co.in
Match details
| # | Match | Index | Len | Groups |
|---|---|---|---|---|
| 1 | support@infiq.in | 12 | 16 | — |
| 2 | privacy@infiq.in | 32 | 16 | — |
| 3 | team.lead+wa@infiq.co.in | 94 | 24 | — |
Pattern, explained
\ba word boundary[\w.+-]any one character from this set+the previous item, one or more times@the literal text "@"[\w-]any one character from this set+the previous item, one or more times\.the literal character "."[\w.]any one character from this set+the previous item, one or more times\ba word boundary
Patterns run with JavaScript's native RegExp engine, entirely in your browser — nothing you type is uploaded, logged or stored.
How it works
Three steps, no signup
Write or load a pattern
Type your expression between the slashes or one-click a preset — email, Indian phone, GST, UUID, JWT and 24 more load with sample text included.
Toggle flags, read matches
Flip g, i, m, s, u, y or d and watch matches re-highlight instantly, with a details table showing every capture group, index and length.
Preview replace and split
Switch tabs to see String.replace with $1/$<name> substitutions or the split result — then copy the regex or the matches straight into your code.
Good to know
Three habits that make regex dependable
Anchor before you trust. A pattern like \d{6} happily matches the middle of a 16-digit card number, which is how “PIN code validation” quietly accepts garbage. When you are validating a whole value rather than searching inside text, wrap the pattern in ^ and $ (with the m flag if you validate line-by-line) so the entire input must conform — most of the presets in this tool that validate identifiers do exactly that.
Prefer character classes to the dot. “.*” is the duct tape of regex: it works until it matches far more than intended, especially combined with backtracking. Matching [^"]* inside quotes, [\w.-]+ inside an email local part, or \d+ where only digits belong makes patterns faster, safer and self-documenting — and it is the single best defence against the catastrophic-backtracking shapes this tool warns about.
Keep a test corpus next to the pattern. A regex is code, and the sample box here is its unit test: keep two or three strings that must match and — just as important — two that must not. When a teammate later “just tweaks” the pattern, those counter-examples are what stop a subtle widening. The share button preserves your pattern and flags in the URL, so a reviewable test case is one link away.
FAQ
Frequently asked questions
Which regex engine does this tester use?
Your browser's native JavaScript RegExp engine — the same one Node.js and every web app use. That matters because engines differ: the d (indices) flag is JavaScript-specific, and PCRE-only syntax like possessive quantifiers or atomic groups will report a syntax error here exactly as it would in your JS code — so a pattern that works in this tool works in production JavaScript.
What do the g, i, m, s, u, y and d flags actually do?
g finds every match instead of stopping at the first; i ignores letter case; m makes ^ and $ match at each line break; s lets the dot match newlines too; u switches on full Unicode mode (needed for \p{…} classes and correct emoji handling); y anchors each match to start exactly where the previous one ended; d records start and end offsets for every capture group.
Why does my pattern match in this tool but not in my code?
The usual suspects are escaping and flags. Inside a JavaScript string literal every backslash must be doubled ("\\d" for \d) — copying a pattern into single-backslash string form is the classic breakage. Also check that the flags you enabled here made it into your code, and that the input in production really is one string, not an array or already-split lines.
What is catastrophic backtracking and how do I avoid it?
Patterns like (a+)+ or (\w*)* give the engine exponentially many ways to split the same text, so on a long non-matching input the match can take seconds or minutes — a denial-of-service risk if user input reaches such a pattern on a server. This tool warns when it spots nested unbounded quantifiers. The fix is to make repetition unambiguous: replace nested quantifiers with a single one, anchor the pattern, or match a stricter character class.
Do the GST, PAN and Aadhaar presets validate real numbers?
They check the format only — the right length, character classes and structure. A string can be format-perfect and still not exist: GSTIN and PAN embed check characters, Aadhaar uses the Verhoeff checksum, and card numbers use Luhn, none of which a plain regex verifies. Treat these presets as first-pass input validation, and remember everything you paste here stays in your browser.
More free tools
Keep your stack sharp
JSON Template Validator
Paste template JSON and catch structural errors before Meta review does.
Open toolWebhook Payload Formatter
Pretty-print and annotate WhatsApp webhook payloads for faster debugging.
Open toolTemplate Variable Checker
Lint {{n}} variables — gaps, duplicates and edge-position mistakes.
Open toolPhone Number Formatter
Convert phone numbers to E.164 — single numbers or whole lists.
Open toolReady to do this at scale?
InfiQ puts broadcasts, chatbots, a shared inbox and the developer API behind one dashboard — on the official WhatsApp Business API. 7-day free trial, no card required.
