All Over Tools logo
Tool Combiner
Analyze Tools Clean Tools Compare Tools Convert Tools Data Validation Extract Tools Format Tools Generate Tools Organize Tools Transform Tools
Image Tools Video Tools Audio Tools Subtitle Tools Font Tools
Analyze Tools Clean Tools Compress Tools Convert Tools Edit Tools Extract Tools Generate Tools Merge Tools Organize Tools Redact Tools Repair Tools Split Tools
Analyze Tools Clean Tools Compare Tools Convert Tools Extract Tools Generate Tools Merge Tools Transform Tools Validate Tools
Business Calculators Construction Calculators Date And Time Calculators Education Calculators Financial Calculators Food Calculators Health Calculators Math Calculators Science Calculators Sports Calculators Statistics Calculators
Blog About Us Contact Us

Regex Tester

Test a JavaScript regular expression against sample text. See highlighted matches, capture groups, and match indexes as you type.

/g
Flags

Use the Regex Tester

What is the Regex Tester? It runs a JavaScript regular expression against sample text and shows matches in Highlighted Text, with each match's index, length, and capture groups in Matches.

How the Regex Tester Works

Enter a pattern between the slash marks and toggle the visible flag buttons: g, i, m, s, u, and y. The tool uses the browser's native JavaScript RegExp engine.

When neither g nor y is selected, the implementation adds g internally to enumerate matches. This can differ from a single native non-global RegExp.exec call.

What the Results Show

  • Highlighted Text marks non-empty matches inline. Zero-length matches appear as thin red markers between characters.
  • Matches lists each match's text, index, length, numbered capture groups, and named groups.
  • A valid pattern with no results shows No matches found. An invalid pattern shows an inline Invalid pattern message.

How to Use the Regex Tester

  1. Type a pattern into the pattern field.
  2. Toggle the visible flag buttons.
  3. Enter or paste sample text. Select Upload to open a .txt file picker; the file is read as text. Dropped files are also read as text.
  4. Review Highlighted Text and Matches. Results update when the pattern, sample text, or flags change.

Zero-Length Matches and the 5,000-Match Cap

Patterns such as a* or (?:) can produce zero-length matches. After an empty match, the scan position advances by one UTF-16 code unit so it can continue without stalling.

The tool reports a maximum of 5,000 matches. When the cap is reached, the stats show capped at 5000, so the displayed results and total do not include matches beyond that limit. An empty pattern or empty sample text shows an instructional placeholder.

Copy and JSON

When at least one match is listed, Copy sends tab-separated match number, text, index, and length to the browser Clipboard API. The page does not show a success or failure message, so copying may not complete in every browser context.

JSON downloads regex-matches.json with each match's text, index, length, zeroLength, numbered groups, and named groups. With no matches, both controls return without taking action.

Browser-Side Processing and Limitations

Matching and file reading are implemented in browser-side JavaScript. The inspected tool code does not establish an absolute privacy guarantee for the whole page. Only g, i, m, s, u, and y are exposed as flag controls, and results are capped at 5,000 matches.

Frequently Asked Questions (FAQs)

Which regex flavor does this tool use?

It uses your browser's native JavaScript regular expression engine (the same one used by RegExp in JS), so behavior matches what you'd get in a Node.js or browser script.

What flags are supported?

g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), and y (sticky). Toggle any combination and matches update instantly.

How are zero-length matches handled?

Patterns that can match an empty string (like a* or (?:)) are detected and the scan position is advanced by one UTF-16 code unit after each empty match, so the tool reports them without freezing the page.

Does this tool extract or export matches like a data set?

There is no dedicated extraction or data-set workflow. When matches exist, you can download their current details as JSON by selecting JSON.

Related Tools

12 views