Online developer tool
Regular Expression Tester
Write a pattern, pick flags, and paste test text. Matches are highlighted live, with capture groups and an optional replace preview.
Pattern
How to use this tester
Purpose
Use this tool to build and debug a regular expression against sample text before using it in code, checking captured groups and replacements as you go.
Main steps
- 1Type a pattern in the Pattern field, without the surrounding slashes.
- 2Toggle flags: g (global) is always on, plus i (ignore case), m (multiline), s (dot matches newline), and u (unicode).
- 3Paste or type text into the Test string panel. Matches are highlighted automatically as you type.
- 4Check the Matches list for each match's position and any numbered or named capture groups.
- 5Optionally fill in the Replacement field (supports $1, $2, $<name>) to preview the result of String.replace with this pattern.
//g
Flags
Client-side only · nothing is uploaded
Test string
Enter a pattern to start testing.