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
Choose a mode
| Mode | Use it to |
|---|---|
| Match | Find text and inspect capture groups. |
| Substitution | Replace matches and keep other text. |
| Extraction | Build output from matches only. |
| Unit Tests | Check results against saved expectations. |
Enter the example
This pattern finds order identifiers and captures their four digits.
- Open regex101 and select Regex Editor in the left navigation rail.
- Select JavaScript in the flavor selector.
- Select Match mode.
- Enter this pattern in Regular Expression:
\bORD-(?<id>[0-9]{4})\b
- Enable the
gflag to find every match. - Paste this text into Test String:
ORD-0042 pending
ORD-0187 sent
ORD-42 invalid
XORD-0001 invalid
Read the result
The input contains two matches. The named capture group id contains each match's four digits.
| Full match | Group id |
|---|---|
ORD-0042 | 0042 |
ORD-0187 | 0187 |
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.
Change one part
- Change
{4}to{2,4}. - Verify that
ORD-42now matches. - 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.