Skip to main content

Test multiple strings

Multiple test strings let you compare separate inputs with one pattern. Each input has its own result.

Free
Included: two test strings
Pro
Included
Self-hosted
Included
Compare plans

Add inputs​

  1. Enter your pattern and select its engine and flags.
  2. Enter the first input in the test string editor.
  3. Select Add test string (+) beside the input tabs.
  4. Enter another input.
  5. Repeat for the cases that exercise different behavior.
  6. Change the pattern and compare the results across the inputs.

Hover over a tab to reveal Tab actions (⋮). Select it to open the tab menu. You can also right-click the tab.

To use a file as an input, follow Load files.

The inputs use the same pattern and flags. Results update when the editor runs the pattern against each input.

Compare matching and nonmatching inputs​

Use JavaScript, no flags, and this pattern:

^ORD-[0-9]{4}$

Compare these matching and nonmatching inputs:

InputExpected resultPurpose
ORD-0042One full matchOrder format
ORD-9999One full matchFour digits
ORD-42No matchToo few digits
ORD-00420No matchToo many digits
XORD-0042No matchUnexpected prefix
Empty stringNo matchMissing input

The demonstration compares order and invoice identifiers in four input tabs.

Add invoice support to the shared pattern while keeping short identifiers rejected.
  1. Inspect the matching order and the rejected short identifier.
  2. Change the prefix to (?:ORD|INV) while keeping [0-9]{4}.
  3. Compare the order and invoice results across the tabs.
  4. Verify that the short identifier still has no match.

Open in regex101

An example link can open the pattern and one input. Use the table to create the remaining separate inputs.

Use inputs with AI Assistant​

To share examples with AI Assistant, select them under Attachments > Test strings. Edit their content in the editor. Your next request uses the updated text.

Save the test set with the workspace​

Save the workspace to keep the pattern and its test strings together. Reopening that workspace restores the collection.

Sharing also includes the saved inputs. Use synthetic examples or remove sensitive text before creating a shared version.

Multiple test strings show results. Unit tests add explicit expectations that can pass or fail.