Regex Tester

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.

3 matches
-

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

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

© 2019 to 2026 Calculate.co.nz. All rights reserved.