Regex Tester
Developer Tools · Added 15 July 2026
Write a pattern, paste some test text, and see every match highlighted as you type. Capture groups are listed per match with their positions, flags are toggled with checkboxes, and a replace field previews the substitution.
How to use the regex tester
- 1Enter your pattern — no surrounding slashes needed.
- 2Toggle the flags you want: global, case-insensitive, multiline, dot-all, unicode.
- 3Paste test text underneath; matches highlight immediately.
- 4Add a replacement string to preview the result of a replace operation.
Examples
Extracting years
- Input
- Pattern \b(19|20)\d{2}\b against a paragraph of prose
- Result
- Every four-digit year highlighted, with the century captured in group 1
Reformatting with groups
- Input
- Pattern (\w+)@(\w+)\.com, replacement $1 at $2
- Result
- ada@example.com becomes ada at example
About the regex tester
Building a pattern incrementally
The reliable way to write a regular expression is to start with the simplest thing that matches one example and tighten it. Match the literal text first, then replace the parts that vary with character classes, then add quantifiers, then add anchors.
Testing against text that should not match is just as important as testing text that should. A pattern that matches everything you feed it is usually broken in a way you will not discover until production.
Use named groups and comments
Named capture groups — (?<year>\d{4}) — cost nothing and make both the pattern and the code that consumes it readable. Referring to match.groups.year beats match[3], particularly after someone inserts a group in the middle.
And know when to stop. Regular expressions cannot parse nested structures such as HTML or JSON, because those are not regular languages. If your pattern is growing lookaheads to handle nesting, reach for a real parser instead.
Frequently asked questions
Which regex flavour is this?
What does the global flag change?
Why does my pattern hang the page?
Can I use this to validate email addresses?
Related tools
JSON Validator
Developer Tools
Check JSON validity and get a structural summary — depth, key count and type breakdown.
Text Cleaner
Text Tools
Strip extra spaces, blank lines, line breaks, HTML tags, punctuation and smart quotes.
URL Encoder / Decoder
Developer Tools
Percent-encode and decode URLs and query parameters, with a query string breakdown.