Skip to main content

Test multiple strings

Multiple test strings keep distinct inputs beside one pattern. Each input has its own result, so an empty string remains a separate case.

Free
One test string
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 area.
  4. Enter another input.
  5. Repeat for the cases that exercise different behavior.
  6. Change the pattern and compare the results across the inputs.

The inputs use the same pattern and flags. Match results update as the editor runs the pattern against each input.

Compare matching and nonmatching inputs​

Use JavaScript, no flags, and this pattern:

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

Create one test string for each row:

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 uses three inputs: ORD-0042, ORD-42, and ORD-0187. Switching tabs shows each input's separate result.

Compare three inputs, then change the shared pattern so the shorter identifier also matches.
  1. Select Input 1 to inspect the match for ORD-0042.
  2. Select Input 2 to verify that ORD-42 has no matches.
  3. Add Input 3 with ORD-0187. The four-digit identifier matches.
  4. Change the pattern to ^ORD-[0-9]{2,4}$ and select Input 2. Now ORD-42 matches too.

The last change accepts two, three, or four digits. Restore {4} if your identifiers must contain exactly four digits.

The pattern is shared across all three inputs.

Open in regex101

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

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.

Access and practical limits​

Free supports one editable test string. A saved workspace with multiple test strings becomes read-only without the required feature access.

With Free, you can paste these inputs into the same editor one at a time. Keep the empty string as a separate run.

Each input runs under the configured execution timeout. Large collections also use more browser memory.

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