Test a regex.
Catch the edge case.
Try a JavaScript regular expression against sample text, inspect capture groups, and preview a replacement without sending the text anywhere.
How do I test a regular expression? Paste a pattern and test text to see matches and groups highlighted live.
Regular expression tester
This tester uses the JavaScript RegExp engine. Patterns and test text stay in your browser; a maximum input size keeps accidental runaway patterns manageable.
How to test a regular expression
- Enter your pattern — plus the sample text to run against it.
- Read the highlights — matches, capture groups, and indexes are shown live.
- Try the replacement — preview substitutions before putting the regex into code.
When this saves you
- Building validators (emails, phone numbers, IDs) with real samples
- Debugging log parsers that mysteriously skip lines
- Verifying a search-and-replace before running it in bulk
Good to know
This uses JavaScript regex flavor — most patterns port to other languages, but not all. Always test the boring edge cases (empty string, unicode, trailing newline), and keep patterns specific: vague ones like .* repeated can cause catastrophic backtracking and freeze a tab. Related: SQL formatter for query cleanup.
Which regex syntax is supported?
This page uses the regular expression syntax built into your browser's JavaScript engine, including flags such as g, i, m, s, u, and y.
Why are there no matches?
Check the pattern, flags, and whether you need a global g flag for repeated matches.