Regex playground
Test regular expressions and preview replacements.
About Regex playground
Try a regular expression against sample text before putting it into code. The playground uses JavaScript regex behavior, including its flags and replacement syntax.
Steps, example, and limitations
How to use it
- Enter a pattern, flags, and sample text.
- Run the test and inspect matches and capture groups.
- Add replacement text when needed and review the replacement preview.
Example
Input
Pattern: \d+ Flags: g Text: Order 42, item 7
Result
Matches: 42 and 7
Things to know
- Regex syntax differs between languages; a JavaScript match does not guarantee identical behavior in another engine.
- Some patterns take too long on certain input. The worker timeout stops an excessive run rather than freezing the page.