Regex tester
Write and test regular expressions with live match highlighting, capture groups and a replace preview, plus ready-made patterns for Australian data.
How to test a regex
- Type your pattern in the regular expression box, or pick a common pattern.
- Paste your test text. Matches are highlighted as you type.
- Check the match details to see each match and its capture groups, and try a replacement.
Ready-made patterns for Australian data
- AU mobile and landline numbers, with or without +61
- Postcodes, including NT postcodes starting with 0
- ABNs with or without spaces
- Dates in dd/mm/yyyy format
- Dollar amounts, emails, URLs, hex colours and IP addresses
JavaScript or RE2?
Regex comes in different flavours. Switch the engine at the top of the tool to test the one you need:
- JavaScript: used by web browsers, Node.js and Google Tag Manager. Supports lookaheads, lookbehinds and backreferences.
- RE2: Google’s engine, used by GA4, Looker Studio, BigQuery, Google Sheets and Search Console. It’s fast and safe but leaves out lookarounds and backreferences, so a pattern that works in JavaScript can fail in GA4.
Testing a GA4 filter? Tick whole line must match. GA4’s “matches regex” condition needs the pattern to match the entire value, so /blog/ won’t match /blog/post-1 unless you add .*.
Flags explained
gglobal: find every match, not just the firstiignore case: treat upper and lower case the samemmultiline: make^and$match the start and end of each linesdot-all: let.match new lines toouunicode: full Unicode support, including emoji
Frequently asked questions
Is this regex tester free?
Yes. It’s free with no signup.
Which regex flavour does it use?
Both JavaScript and RE2. Use JavaScript for code, browsers and Google Tag Manager, and RE2 for GA4, Looker Studio, BigQuery, Google Sheets and Search Console.
Why does my regex work here but not in GA4?
GA4 uses RE2, which doesn’t support lookaheads like (?=...), lookbehinds or backreferences like \1. GA4 also needs the pattern to match the whole value. Switch to RE2 and tick “whole line must match” to test it the way GA4 will.
How do I use capture groups in a replacement?
Wrap part of your pattern in brackets, then use $1 or \1 in the replacement. For named groups like (?<year>\d{4}), use $<year> or ${year}. In RE2 you can also write named groups as (?P<year>\d{4}).
Is my text uploaded?
No. Testing happens in your browser and nothing is sent to a server.