SmartWebTools / SMART LITTLE TOOLS FOR EVERYDAY TASKS
SmartWebTools / Developer Tool

Regex Tester

Type a pattern and test text to see every match highlighted live, along with each match's position and capture groups.

SN RX-46
Advertisement

How this works

Your pattern is compiled using JavaScript's native RegExp engine — the same one that runs in browser JavaScript and Node.js — so a pattern that works here will behave the same way in your actual code. Matches are highlighted directly in the test text, and each match's position and any capture groups are listed below.

Common regex building blocks

  • \d digit, \w word character, \s whitespace
  • + one or more, * zero or more, ? optional
  • () capture group, (?:) non-capturing group
  • ^ start of string/line, $ end of string/line

Frequently asked questions

Why do I need to check the "g" (global) flag?

Without the global flag, the pattern only finds the first match in the text. Check "g" to find and highlight every match, not just the first one.

What does the "i" flag do?

It makes the match case-insensitive, so a pattern like "cat" would also match "Cat" or "CAT".

Why does my pattern say it's invalid?

This usually means a syntax error — an unclosed bracket or parenthesis, an invalid escape sequence, or a special character that needs escaping (like a literal period, which should be written as \. to match a literal dot instead of "any character").

Is my test text sent anywhere?

No — the regex engine runs entirely in your browser using JavaScript's built-in RegExp object. Nothing is uploaded to a server.

Advertisement