boxtool.io

Regex Tester

Write a pattern, paste your text, and see matches highlighted in real time. Supports all JavaScript RegExp flags and capture groups.

//

Test text

Matches

No matches

No matches found

About Regex Tester

The Regex Tester lets you write and debug regular expressions interactively using JavaScript's native RegExp engine. Paste any text, toggle flags (g, i, m, s, u), and watch matches highlight in real time. Capture groups — both numbered and named — are listed for every match. A built-in cheatsheet covers the most commonly used patterns.

Use Cases

  • Validate email, URL, or phone number formats before writing production code
  • Extract structured data (dates, IDs, prices) from logs or raw text
  • Debug a complex regex by building it incrementally and watching matches update
  • Learn regex syntax interactively using the built-in cheatsheet

Tips

  • Use the g flag to find all matches — without it, only the first is returned
  • Named groups (?<name>) make patterns more readable and maintainable
  • Add ^ and $ with the m flag to match line boundaries, not just string boundaries
  • Use the cheatsheet to quickly look up quantifiers, anchors, and group syntax

Frequently Asked Questions

This tool uses JavaScript's built-in RegExp engine, which runs natively in your browser. It supports all standard ECMA-262 regex features including lookaheads, lookbehinds, named capture groups, and Unicode property escapes.

Each flag changes how the pattern is applied: g (global) finds all matches instead of just the first; i (case insensitive) makes A match a; m (multiline) makes ^ and $ match the start and end of each line; s (dotall) makes the dot (.) match newline characters.

Parentheses in a regex create capture groups. For example, (\d{4})-(\d{2})-(\d{2}) against "2024-06-15" captures three groups: "2024", "06", and "15".

Only text that matches your pattern gets highlighted in yellow. Non-matching text stays at its normal colour. If you see no highlights, the pattern has no matches in the current test text.

Greedy quantifiers (*, +, {n,m}) match as much text as possible. Lazy quantifiers (*?, +?, {n,m}?) match as little as possible.

Mostly yes. Most regex syntax is shared across languages. For JavaScript code specifically, results from this tool are a perfect match.

Related Tools

Ad