Skip to content
Runs local · no upload

Test Regular Expressions Live

Paste your pattern and test string, see matches highlighted in real time — supports flags g, i, m, s and shows capture groups with index offsets.

Flags
Ergebnis 2 Treffer
Schreib uns an [email protected] oder [email protected].
  1. 01
    [email protected] Position 15, Länge 19
    • $#1 hello
    • $#2 konverter.app
  2. 02
    [email protected] Position 40, Länge 20
    • $#1 support
    • $#2 konverter.de

How It Works

  1. 01

    Paste input

    Paste the content you want to validate into the input field.

  2. 02

    Instant validation

    The tool immediately checks whether the input is valid and shows details.

  3. 03

    Read result

    Valid input is highlighted in green; errors are shown in red.

Privacy

All calculations run directly in your browser. No data is sent to any server.

Debugging a regular expression without instant feedback is painful. This tool runs your pattern against any test string in real time using JavaScript's native regex engine, highlights every match, and breaks out capture groups so you can verify each part of your pattern independently.

01 — How to Use

How do you use this tool?

  1. Type or paste your regular expression into the Pattern field (without surrounding slashes).
  2. Select any flags you need: g (global), i (case-insensitive), m (multiline), s (dotAll).
  3. Paste your test string into the input area below.
  4. Matches highlight instantly — hover over a match to see its index and capture groups.
  5. Adjust the pattern and watch the results update with every keystroke.

What This Tool Does

The Regex Tester provides a live sandbox for JavaScript regular expressions. Paste a pattern and a test string, and the tool highlights every match in real time — no page reload, no button press. Capture groups are extracted and labeled so you can inspect each part of a complex pattern independently.

How It Works

The tool feeds your pattern and flags directly into JavaScript’s RegExp constructor and runs String.prototype.matchAll() (or exec() in a loop for stateful iteration). Each match object contains:

  • Full match — the entire substring that matched
  • Index — the zero-based position in the source string
  • Capture groups — numbered ($1, $2) and named (groups.name) sub-matches

Everything runs in your browser. Your pattern and test data never leave your machine.

What Regex Flags Are Available?

FlagNameEffect
gGlobalReturn all matches, not just the first
iCase-insensitiveA matches a
mMultiline^ / $ match line boundaries
sDotAll. matches \n and \r
uUnicodeEnable full Unicode matching
dIndicesInclude start/end indices per group (ES2022)

What Are Common Use Cases?

Validating US phone number formats — US phone numbers appear in dozens of formats: (555) 867-5309, 555-867-5309, 5558675309. A regex like \(?\d{3}\)?[\s\-]?\d{3}[\s\-]?\d{4} matches all variants. Test every format before deploying to a form validator.

Parsing log files — Server logs from Apache, Nginx, AWS CloudFront, and Cloudflare Workers follow structured but messy formats. Build a pattern against a sample line, verify capture groups extract IP, timestamp, status code, and path correctly, then port it to your log-parsing script.

Extracting data from HTML or CSV — Quick scraping jobs often start with a regex. Test your pattern against a sample before running it across thousands of rows.

Form validation — ZIP code (\d{5}(-\d{4})?), SSN (\d{3}-\d{2}-\d{4}), email, and credit card patterns all benefit from live testing before going into production code.

Find-and-replace in editors — VS Code, JetBrains IDEs, and Sublime Text all support regex find-and-replace. Prototype the pattern here where you can see matches highlighted, then paste it into your editor.

Frequently Asked Questions

What is the difference between test() and match()? RegExp.prototype.test(str) returns a boolean — useful when you only need to know if a pattern matches. String.prototype.match() returns the match array. This tool uses matchAll() to surface all matches and their groups.

Why does my regex work in one tool but not another? Regex syntax is not fully standardized across languages and tools. JavaScript supports named capture groups ((?<year>\d{4})), lookbehind assertions ((?<=@)\w+), and Unicode property escapes (\p{L}) — features absent or syntactically different in older tools. Always validate in the environment where the code will run.

Last updated:

You might also like