Regex Tester

Test a regular expression against sample text and instantly see how many matches it finds and what they are. This free online developer calculator runs entirely in your browser — no signup, no data sent anywhere.

· Reviewed by the CalculatorHive editorial team

Inputs

Results

Pattern Status
Match Count
First Match
All Matches

How It Works (Formula & Method)

The tester compiles your pattern and flags into a native JavaScript RegExp and runs it against the test text. The global flag g is added automatically so that every match is found, not just the first. If the pattern is invalid, the engine's error message is shown instead of a match count.

Enter the pattern without the enclosing slashes — for example type \d{3}, not /\d{3}/. Common flags are g (global), i (case-insensitive), and m (multiline).

Worked Example

Below is a worked example using the calculator's default values. The same numbers are pre-filled in the form above so you can press Calculate and see the result without typing anything.

Inputs used:

  • Regular Expression (pattern only, no slashes): \w+@\w+\.\w+
  • Flags (e.g. g, i, m): g
  • Test Text: Contact hi@example.com or sales@test.org.

With these inputs, the calculator computes the metrics shown in the Results panel. Change any value and press Calculate again to see how the result responds — the live widget and the chart both update instantly.

Tips & Considerations

This uses the JavaScript regex flavour, which differs slightly from PCRE, Python, or Java — lookbehind and named groups are supported in modern browsers, but some syntax from other languages will not carry over. Because everything runs locally, no pattern or test data leaves your device.

Frequently Asked Questions

Which regex flavour does this use?

It uses the browser's native JavaScript (ECMAScript) regular-expression engine. Most patterns are portable, but details such as lookbehind, named capture groups, and Unicode property escapes follow the JavaScript specification rather than PCRE or Python.

Do I include the slashes in the pattern?

No. Enter only the pattern body, such as \d{3}-\d{4}. Put any flags like g or i in the separate flags box rather than wrapping the pattern in /.../.

What does the Regex Tester compute?

The Regex Tester takes 3 input values and returns 4 results. Test a regular expression against sample text in your browser, using the native JavaScript regex engine, and see the match count and every match found.

Is my data sent to a server?

No. The Regex Tester runs entirely in your browser using static JavaScript. Your inputs are never transmitted to CalculatorHive or any third party, and nothing is stored after you close the page.

Ad placement