Rankite
ServicesResultsToolsTeamAboutBlogCareersContactFree SEO Audit
Free tool

Regex Tester

Enter a pattern and a test string to see every match highlighted inline, along with each match's index and capture groups.

Home / Tools / Regex Tester
Result
Enter a pattern and test string, then click Test regex.

Built by Rankite, the SEO team behind Swordfish AI's +400% revenue and Zluri's +45% organic growth. See the case studies

How the matching works

This tool builds a native JavaScript RegExp from your pattern and flags, then scans the entire test string for every match rather than stopping at the first one, adding the g flag internally if you left it off so you always see the full picture. Each match is listed with its zero based starting index and any capture groups it produced, and every match is also highlighted directly in the test string so you can see exactly what got selected.

What the flags do

The g flag finds every match instead of only the first. The i flag makes matching case insensitive. The m flag changes ^ and $ to match the start and end of each line instead of only the whole string. The s flag lets the dot character match line breaks as well. You can combine flags, like gi for a case insensitive global search, by typing them together.

Reading capture groups

Parentheses in a pattern create a capture group, a piece of the match you can reference separately, and this tool lists each group's value under its match using the standard $1, $2 notation. A group that did not participate in a particular match, for example one side of an alternation like (cat|dog), shows as no match rather than an empty string, which is the correct distinction JavaScript itself makes.

Related articles

FAQ

Regex Tester: questions, answered

What regex engine does this use?
Your browser's native JavaScript regular expression engine, the same one that powers String.match, String.replace and RegExp in any web page or Node.js script, so a pattern that works here behaves identically in your own code.
Why do I see matches even though I didn't add the g flag?
This tool always scans for every match so the results are useful, adding the g flag internally if it is missing. Your own code will still behave differently without g, since JavaScript's exec and match methods return only the first match unless the g flag is explicitly set.
Does this support lookahead and lookbehind?
Yes. Anything supported by JavaScript's RegExp, including lookahead (?=...), negative lookahead (?!...), lookbehind (?<=...) and named capture groups (?...), works exactly as it would in your own code, since this tool simply constructs a real RegExp object.
Why does my pattern throw an error here?
A regex error usually means unbalanced parentheses or brackets, an invalid quantifier like a stray *, or a flag combination your pattern does not support, such as the u flag alongside certain legacy syntax. The exact error message from the JavaScript engine is shown so you can see what it rejected.
Is my pattern or test text sent anywhere?
No. Matching happens entirely in your browser using JavaScript's built in RegExp object. Nothing you type is uploaded, logged or stored.

More free tools

Let's grow

Ready to own page one?

Get a free, no-obligation SEO audit and a 30-minute strategy session. We'll show you exactly where the growth is hiding.

Book your free audit Explore services
Get in touch

Tell us about your project

Fill out the form and we'll get back to you within one business day. Prefer email? Write to us directly at contact@rankite.com.

Or copy our email and write to us directly: contact@rankite.com