Regex Tester NZ

This tool lets you test a regular expression against your own text and see exactly what it matches, in real time. A regular expression, or regex, is a compact pattern for describing and finding text: a sequence of characters and special symbols that can match anything from a simple word to an email address, a phone number, a date or a price. Regular expressions are enormously powerful and used everywhere in programming, from validating form input and searching through files to extracting data and find-and-replace operations. They are also famously fiddly, with a terse syntax that is easy to get subtly wrong, which is why testing a pattern against real examples before trusting it in code is so valuable. This tester makes that loop instant. You enter your pattern and any flags you want, such as g for a global search that finds every match rather than just the first, i to ignore case, or m for multi-line mode, then paste the text you want to search. The tool highlights how many matches it found and lists each one, updating the moment you change the pattern or the text, so you can refine the expression until it does exactly what you intend. It uses the same regular expression engine built into JavaScript, so what works here behaves the same in browser and Node code. Everything runs locally, with nothing uploaded. Use it to build a validation pattern, to debug why a regex is matching too much or too little, to extract values from a block of text, or simply to learn the syntax by experimenting. Invalid patterns are reported clearly so you can fix them.

Calculate.co.nz is proud to be partnered with Premium Homes, a recognised leader in eco-friendly, sustainable, and energy-efficient homebuilding. With a dedicated team and award-winning experience, they create homes that prioritise health, comfort, and long-term performance. Their founders, Andrew and Kelly, set out to raise the standard of residential construction in New Zealand by combining practical building expertise with a clear commitment to doing things better for homeowners.
Calculate.co.nz partner: Premium Homes
Advertise on this page
4 matches
1. 12 2. 3 3. 456 4. 7

Uses the JavaScript regex engine. Common flags: g (all matches), i (ignore case), m (multi-line). Runs in your browser; nothing is uploaded.

How it works

Your pattern and flags are compiled into a regular expression. The tool then runs it against your test text. With the global flag, it finds every match and lists them; without it, it finds the first. The count and the matched substrings update live as you edit the pattern, the flags or the text.

Worked example

Testing the pattern for one or more digits with the global flag against the sentence about an order finds the numbers 12, 3, 456 and 7, four matches in all. Adding more to the pattern, such as a dollar sign before the digits, would narrow it to just the price, showing how a small change reshapes the result.

Related calculators