Developer
Regex Tester
Try a JavaScript regular expression against sample text, inspect capture groups, and preview a replacement. The pattern is compiled with the RegExp engine in your browser.
Loading tool…
This runs entirely in your browser. Nothing you type is sent to a server.
How to test a regular expression
- 1Enter a pattern without surrounding slashes, then choose flags.
- 2Paste the text you want to test. Matches and capture groups are listed underneath.
- 3Add a replacement if you want to preview the result. Use $1, $2 and so on for groups.
Questions
Which regex flavour is this?
JavaScript. Lookbehind and named groups work in current browsers. A pattern copied from another language may need small changes.
What does the global flag change?
With g, every non-overlapping match is listed. Without it, only the first match is shown, which is how RegExp behaves in JavaScript.