Skip to main content

Pattern Regex

Test Cases

1
2

Import Bulk (JSON)

Riepilogo

Esegui i test per vedere il riepilogo

Come utilizzare Regex Test Suite

Write the regular expression pattern

Insert your regular expression to test and desired flags (e.g., g, i, m) in the designated fields.

Define Test Scenarios

For each test case, enter the input string and expected result: match, no-match, or group (with value and capture group index expected).

Run tests

Click "Run Test" to validate the pattern on all cases simultaneously: each row shows a PASS or FAIL badge with the actual value obtained.

Export or import results

Download the report in Markdown, copy a text summary, or import new test cases in bulk via JSON.

Suggerimenti

  • Always cover at least one "match" and one "no-match" to avoid false positives on overly permissive patterns.
  • Use the "group" type to validate data extraction, not just boolean pattern matching.
  • Export Markdown report before modifying the pattern, so you have a history of iterations on the regex.

Domande frequenti

What does the "group" type of test mean?

Group" verifies that a specific capture group (identified by the index, 0 = full match) returns exactly the expected value. It's useful for validating patterns with capture parentheses, e.g., extracting usernames from an email address.

How many cases of tests do you want to import together?

In the "Import Bulk (JSON)" section, paste a JSON array with objects

Why does a test with an expected result of "match" result in FAIL even if the pattern seems correct?

Check flags: using the "g" flag may affect exec() behavior between successive calls due to lastIndex. The tool automatically removes "g" from used flags for deterministic and repeatable test execution results.

Can I test a pattern with syntax errors?

If the pattern is not a valid regular expression, an error message with the detail of the problem (e.g., open parenthesis) will be shown before running tests, so you can correct it immediately.

In what format is the report exported?

The downloaded report is a Markdown file (.md) with patterns, flags, pass/fail/total counts and a table with input, expected result, actual result, and status for each test case - ready to be pasted into a PR or documentation.