Regex Tester

Regex Tester

Build and test regular expressions with live match highlighting, capture groups, and a replace mode. JavaScript flavour, runs entirely in your browser.

JavaScript / ECMAScript regex (the same engine your browser uses for the native RegExp). It's a strict superset of POSIX and overlaps heavily with Python re, Java Pattern, and PCRE for the common features. Differences to watch out for: JavaScript supports lookahead/lookbehind, named groups (via /(?...)/), and the /u and /y flags. It does NOT support possessive quantifiers (a++, a*+), atomic groups ((?>...)), or branch-reset groups — those are PCRE-only.

No. The whole tool is JavaScript inside this page. Pattern compilation, matching, and replacement all run in your browser via the native RegExp constructor. Open DevTools → Network and watch — no requests fire while you type. Safe to paste regexes that match production logs, customer emails, or anything else you wouldn't want a server tool to log.

/ /
Matches
Explanation
Regex cheatsheet
. Any character (except newline; with /s flag, also newline)
\d Any digit (0-9)
\D Any non-digit
\w Word character (a-z, A-Z, 0-9, _)
\W Non-word character
\s Whitespace (space, tab, newline)
\S Non-whitespace
\b Word boundary
^ $ Start / end of string (or line, with /m flag)
* Zero or more of the previous element
+ One or more of the previous element
? Zero or one of the previous element (optional)
{n,m} Between n and m of the previous element
(...) Capture group — saved into $1, $2, …
(?:...) Non-capture group — useful for alternation without capturing
(?<n>...) Named capture group — referenced as $<n>
[abc] Character class — any one of a, b, or c
[^abc] Negated character class — any character except a, b, c
a|b Alternation — match either a or b
(?=...) Positive lookahead — followed by
(?!...) Negative lookahead — not followed by
(?<=...) Positive lookbehind — preceded by
(?<!...) Negative lookbehind — not preceded by
$1 $<n> Backreference in replace string — numbered or named

Why iKit Regex Tester

Built for developers who want a clean, fast regex playground without the ads, popups, or third-party trackers of legacy tools.

Live match highlighting

Type your pattern and see every match highlighted in the test string in real time. Capture groups are listed alongside with their index range and content.

Match + replace in one tool

Switch to Replace mode to preview the result of String.replace, with full support for $1/$2 numbered backreferences, $ named groups, and $& for the whole match.

All six JavaScript flags

Toggle global, case-insensitive, multiline, dotall, unicode, and sticky as chips — same flags as native RegExp, no surprises porting your pattern to code.

Common pattern presets

One-click presets for email, URL, IPv4, phone, date, hex colour, and UUID — each with a sample test string so you can see exactly what they match.

Built-in cheatsheet

Quick-reference grid for character classes, quantifiers, anchors, groups, and lookarounds — collapsible so it's there when you need it, hidden when you don't.

Privacy by design

Pattern, test string, and replacement all stay in your browser. Verifiable in DevTools → Network: zero requests fire while you type. Safe for production logs and customer data.

How regex matching actually works

Regular expressions look like line noise but the engine behind them is straightforward.

  1. 1

    Compile the pattern

    When you write /foo/ in JavaScript or call new RegExp('foo'), the engine parses your pattern into an internal automaton — a state machine that knows how to walk through input text. Compilation is one-time; matching is fast.

  2. 2

    Walk the input string

    The engine moves a cursor through your test string. At each position, it tries to follow the automaton's path. A character that satisfies the current state advances both cursors; a mismatch backtracks to a previous decision point and tries another branch.

  3. 3

    Capture groups

    Parentheses in the pattern open a capture group: when the engine successfully matches inside them, it remembers what was matched, indexed as $1, $2, etc. Named groups (?<n>...) store under a name. These captures show up in the match object's groups field.

  4. 4

    Replace with backreferences

    String.replace(regex, replacement) walks the same matches but instead of returning them, splices the replacement string in. $1 in the replacement is the literal value captured by group 1 — so you can reformat 2024-01-15 to 15/01/2024 with a single regex.

Common regex tasks

Real situations where you'll reach for a regex tester.

Validating email or URL formats

Build a pattern in the tester, paste sample inputs (the real ones and the edge cases), and see exactly what matches before you commit it to your form validation. The presets give you a sane starting point that handles 95% of real-world input.

Cleaning up log data

Got a log file with mixed timestamps, ANSI colour codes, and IP addresses you want to redact? Use Replace mode with a pattern like \b(?:\d{1,3}\.){3}\d{1,3}\b and replacement [REDACTED] — preview the result before running it through sed on the real file.

Refactoring code with regex find-and-replace

Your IDE's find-and-replace supports regex but doesn't show you a live preview across multiple test cases. Build the pattern here first with sample lines from your codebase, verify the captures and replacement, then paste the working regex into VS Code / IntelliJ.

Extracting structured data

Need to pull every email address out of a contact dump, or every dollar amount from a receipt? Build the matching regex in iKit, copy it into a one-line script (text.matchAll(re)), and you've turned an ad-hoc parsing task into ten lines of code.

Why local regex testing matters

Regex patterns often encode sensitive information: the structure of customer IDs, internal API endpoints, password rules, or PII fields you're trying to redact. Pasting them into a server-side tool — and pasting real test data alongside — leaks both the pattern and the inputs. iKit's regex tester is JavaScript already loaded in your browser tab.

  • Zero network requests during matching or replacement — verifiable in DevTools.
  • Patterns and test strings stay in browser memory; cleared on Clear or page refresh.
  • Safe for production log redaction patterns, customer data validation, and security-sensitive regexes.

Related guides

Deep-dive tutorials and tool comparisons from the iKit blog.

Frequently Asked Questions

Which regex flavour does this support?

JavaScript / ECMAScript regex (the same engine your browser uses for the native RegExp). It's a strict superset of POSIX and overlaps heavily with Python re, Java Pattern, and PCRE for the common features. Differences to watch out for: JavaScript supports lookahead/lookbehind, named groups (via /(?...)/), and the /u and /y flags. It does NOT support possessive quantifiers (a++, a*+), atomic groups ((?>...)), or branch-reset groups — those are PCRE-only.

Are my patterns or test strings uploaded anywhere?

No. The whole tool is JavaScript inside this page. Pattern compilation, matching, and replacement all run in your browser via the native RegExp constructor. Open DevTools → Network and watch — no requests fire while you type. Safe to paste regexes that match production logs, customer emails, or anything else you wouldn't want a server tool to log.

What's the difference between $1 and $<name> in replace?

Both are backreferences in the replacement string. $1, $2, … refer to numbered capture groups in the order they appear in the pattern — (foo)(bar) makes $1 = 'foo', $2 = 'bar'. $ refers to a named capture group declared as (?...) — it's more readable and survives reordering of groups in the pattern. JavaScript also has $& (the whole match), $` (text before the match), and $' (text after the match).

Why doesn't my lookbehind work?

Lookbehinds (?<=...) and (?

How do I match emoji, accented characters, or non-Latin scripts?

Turn on the /u (unicode) flag, then use Unicode property escapes inside your pattern. `\p{L}` matches any letter — including ñ, é, 中, ก, ا. `\p{N}` matches any digit, including non-Latin numerals like ٠-٩. `\p{Emoji}` matches emoji code points. Without /u, the same pattern silently mismatches on surrogate-pair emoji (anything beyond the Basic Multilingual Plane) and treats accented characters as separate base + combining marks. The /u flag tells the engine to interpret your input as Unicode code points, not raw UTF-16 code units — so most cross-language regex bugs disappear with one toggle.