Utility Hub

Regex Tester

Test JavaScript regular expressions against any text in real time. See highlighted matches, capture groups, and match positions. Everything runs in your browser.

Sample presets:

Uses JavaScript RegExp syntax. Matches update in real time. Processed locally in your browser.

Flags:
100% Client-Side Processing
How your privacy is protected

What is a Regex Tester?

A regex tester lets you write a regular expression pattern and instantly see which parts of a text string it matches. This tool uses the native JavaScript RegExp API — the same engine used in Node.js, browsers, and most JavaScript runtimes.

How to use

  • Enter a pattern in the regex input field (without surrounding / delimiters — those are shown for context only).
  • Toggle flags as needed — g for global, i for case-insensitive, m for multiline, etc.
  • Paste test text in the text area.
  • Matches appear immediately — highlighted in the text and listed in the match details panel.

Regex flags

  • g — Global: find all non-overlapping matches. Without this flag, only the first match is returned.
  • i — Case-insensitive: A matches a.
  • m — Multiline: ^ and $ match at line boundaries, not just start/end of string.
  • s — Dot-all: . matches newline characters.
  • u — Unicode: enables full Unicode character class escapes like \p{L}.
  • y — Sticky: matches only at the current position (lastIndex).

Examples

  • Email addresses: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
  • Dates (YYYY-MM-DD): (\d{4})-(\d{2})-(\d{2}) — uses capture groups for year, month, day.
  • Words: \b\w+\b with flag g.
  • HTML tags: <[^>]+>
  • Hex colour codes: #[0-9a-fA-F]{6}

Regular Expression Syntax Cheatsheet

Quick lookup of essential character classes, anchors, and quantifiers supported by modern JavaScript:

TokenCategoryDescriptionExample
.WildcardMatches any single character except newline (unless s flag)a.c matches "abc", "a-c"
\d / \DDigitMatches any digit (0–9) / non-digit\d{3} matches "123"
\w / \WWordMatches alphanumeric character and underscore / non-word\w+ matches "hello_1"
\s / \SWhitespaceMatches space, tab, or newline / non-whitespace\s+ matches multiple spaces
^ / $AnchorMatches start / end of string (or line with m flag)^https?
\b / \BBoundaryMatches word boundary / non-word boundary\bcat\b matches exact word "cat"
* / + / ?Quantifier0 or more / 1 or more / 0 or 1 optionalcolou?r matches "color" or "colour"
[a-z] / [^0-9]Character setMatches character in range / negated range[A-Z] matches uppercase letter

Capture groups

Groups defined with (…) are shown in the match detail panel as Group 1, Group 2, etc. Each group corresponds to the text captured by that parenthesised sub-expression.

Non-capturing groups (?:…) and lookaheads/lookbehinds (?=…) / (?<=…) are supported because the tool uses the full native JavaScript regex engine.

Privacy

Your regex patterns and test text are processed entirely in the browser using the native JavaScript RegExp API. No data is transmitted to any server.

Frequently Asked Questions

Why does my regex only highlight the first match?

By default in JavaScript, a RegExp halts after the first matching sequence. Enable the 'g' (global) flag to match all occurrences throughout your entire test text.

Can I test Unicode characters and emojis?

Yes. Enable the 'u' (unicode) flag so surrogate pairs, emoji sequences, and Unicode property escapes (like \p{Letter}) are properly handled as single units.

Does this tester execute eval() or unsafe code?

No. Patterns are safely constructed using the standard JavaScript RegExp constructor with syntax validation. No arbitrary code execution or eval() is used.

Is my pattern or test text uploaded anywhere?

No. All regex evaluation and syntax matching happens 100% locally in your client's web browser. No data ever leaves your device.