Skip to main content

Regex Editor

Use Regex Editor to build and test regular expressions against your own text. The editor explains the pattern and shows its matches and capture groups. See Navigation and layout to arrange the panels.

Free
Included
Pro
Included
Self-hosted
Included
Compare plans

Choose a mode​

ModeUse it to
MatchFind text and inspect capture groups.
SubstitutionReplace matches and keep other text.
ExtractionBuild output from matches only.
Unit TestsCheck results against saved expectations.

Enter the example​

This pattern finds order identifiers and captures their four digits.

  1. Open regex101 and select Regex Editor in the left navigation rail.
  2. Select JavaScript in the flavor selector.
  3. Select Match mode.
  4. Enter this pattern in Regular Expression:
\bORD-(?<id>[0-9]{4})\b
  1. Enable the g flag to find every match.
  2. Paste this text into Test String:
ORD-0042 pending
ORD-0187 sent
ORD-42 invalid
XORD-0001 invalid

Open in regex101

Read the result​

The input contains two matches. The named capture group id contains each match's four digits.

Full matchGroup id
ORD-00420042
ORD-01870187

The third line has only two digits. The fourth line lacks the word boundary before ORD.

The Explanation panel describes the pattern. The match details connect each highlighted match to its capture groups. The flavor selector determines the regex syntax and engine.

The editor shows the pattern, test input, flavor selector, explanation, and captured groups.
Two matching order identifiers and their named id captures in the JavaScript editor.

Change one part​

  1. Change {4} to {2,4}.
  2. Verify that ORD-42 now matches.
  3. Restore {4} to require four digits.

If your application gives a different result, compare its engine, flags, and input representation.

Use AI Assistant to refine a pattern with examples and tests. For several transformations in sequence, use Text Pipeline.