How to test a regular expression
- Enter your pattern and flags (for example g for global, i for case-insensitive).
- Paste your sample text — matches highlight in real time as you type.
- Inspect the capture groups for each match to verify your pattern structure.
- Preview the replacement result before running the same expression in your code.
- Stuck on syntax? The built-in cheatsheet covers the common tokens.
Frequently Asked Questions
Which flags are supported?
g (global), i (ignore case), m (multiline), s (dot matches newlines), and u (Unicode).
Can I see capture groups?
Yes. The match list shows the capture group content for each match.
Is replacement preview supported?
Yes. Enter a 'Replace With' value to preview the replaced text in real time.
Is data sent to a server?
No. Matching and replacement happen entirely in your browser.
Which regex flavor does it use?
JavaScript regular expressions (ECMAScript). If your target language is Python or Java, most patterns carry over, but lookbehind and a few escapes differ.
How are capture groups shown?
Every match lists its groups numbered left to right, with named groups labeled, so you can confirm the pattern captures exactly the pieces you plan to use.
Can I test the replace() behavior too?
Yes — enter a replacement string and the preview shows the substituted output, including backreferences like $1.
Technical References
- Regular Expressions — MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
- MDN Web Docs — Regular Expressions (JavaScript): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp