Test regular expressions with live match highlighting
Built & maintained by Pappu Venkata Subbi Reddy, founder of Clacify
The Regex Tester lets you write a regular expression and see, in real time, exactly which parts of your test text it matches — with matches highlighted inline, a running match count, and every capture group broken out separately. It supports JavaScript's four commonly used flags (g for global, i for case-insensitive, m for multiline, s for dot-matches-newline), so the behaviour you see here is exactly what you will get when the same pattern runs in a browser, Node.js, or any JavaScript codebase. Because a wrong regex can silently match too much or too little, seeing live highlighted matches against your own real test data — rather than reasoning about the pattern in the abstract — is the fastest way to catch a mistake before it ships. Everything runs locally, so you can safely test patterns against real (even sensitive) sample data without it leaving your browser.
The tool compiles your pattern and flags into a native JavaScript RegExp object and runs it against your test text using matchAll(), which is the standard way to retrieve every match (not just the first) along with each match's index and capture groups. Highlighting is built by walking the matched ranges and splitting the test text into matched/unmatched segments for rendering. If the pattern is invalid — an unclosed group, a bad character class — the RegExp constructor throws a syntax error, which is caught and shown directly instead of failing silently. Because this is the exact engine JavaScript itself uses (not a simplified simulation), a pattern that works here is guaranteed to behave identically in real code.
g (global) makes the engine find every match in the text instead of stopping at the first — almost always what you want when testing, and required for this tool to report a match count rather than a single yes/no. i (case-insensitive) makes "Cat" match cat, CAT, and cAt alike — essential for anything matching user input where casing isn't guaranteed, like email domains or search terms.
m (multiline) changes what ^ and $ mean: without it they anchor to the very start and end of the whole string; with it they anchor to the start and end of every line, which matters when validating or extracting from multi-line text like log files or CSV rows. s (dot-matches-newline, sometimes called "single line" confusingly) changes what . matches: by default . matches any character except a newline, so a pattern spanning multiple lines needs the s flag to have . actually cross line breaks.
A handful of patterns cover most real-world validation needs: \b\w+@\w+\.\w+\b for a rough email shape (production email validation is genuinely harder than most people expect — even this simplified version catches the common cases), ^\d{10}$ for a 10-digit Indian mobile number, ^[A-Z]{5}\d{4}[A-Z]$ for a PAN card format, \bhttps?:\/\/\S+\b for extracting URLs from text, and ^\d{6}$ for a 6-digit Indian PIN code. None of these are exhaustive — real-world validation almost always needs a follow-up check beyond the regex (does that PAN actually exist, is that email domain real) — but they are exactly the shapes you paste into this tool first, to confirm the pattern matches the format before wiring it into real validation code.
Regular expressions are notorious for looking correct and being subtly wrong — a missing escape on a literal dot (. instead of \.) will match any character, not just a period, silently accepting input that should have been rejected. Greedy quantifiers (* and + without a ?) can match far more than intended across a long string. The only reliable way to catch these is to run the pattern against real, messy test data and actually look at what gets highlighted — which is precisely what this tool is for: not reasoning about a regex in isolation, but watching it behave against text that looks like what it will actually encounter in production.
Enter your regex pattern (without slashes) in the Pattern field, add any flags (g, i, m), paste your test string, and matches are highlighted live. Clacify's Regex Tester uses JavaScript's native RegExp engine — the same engine used in Node.js, Chrome, and all modern browsers.
Email: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$. Phone (India 10-digit): ^[6-9]\d{9}$. PIN code (India): ^[1-9][0-9]{5}$. URL: https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}. IP address: \b(?:\d{1,3}\.){3}\d{1,3}\b.