Regex Tester

Regex Tester

Test regular expressions against text and inspect matches.

Flags
Total Matches: 0 Status: Ready
Preview
No matches.
Matches
# Match Index Length
No matches
Capture Groups
Match Group Value
No capture groups

What the Regex Tester Does

Regular expressions are precise, but they are not forgiving — one missing escape character or one misplaced quantifier is the difference between a perfect match and no match at all. This regex tester runs your pattern against real text as you type, highlighting every hit in a live preview and listing each match with its index, its length and its capture groups. Nothing has to be deployed just to find out whether the pattern works.

How to Use the Regex Tester

No pattern or text is sent to a server — everything runs client-side in your browser on the standard JavaScript regex engine.

What Is a Regular Expression?

Common Regex Patterns

The handful of tokens you will reach for again and again, whatever the job:

When You’d Use This

Worked Example

Pattern: (\d{3})-(\d{3})-(\d{4}) Flags: g Test text: Call us at 555-123-4567 or 555-987-6543.

Total Matches: 2 — 555-123-4567 at index 11 and 555-987-6543 at index 27, both 12 characters long.

The pattern looks for three digits, a hyphen, three more digits, a hyphen and then four digits — the usual US phone-number format. The g flag makes the tool report both occurrences instead of stopping at the first, and the three bracketed groups split each number into 555, 123, 4567 and 555, 987, 6543 in the Capture Groups table.

Do’s and Don’ts

Do

Don’t

Common Mistakes

Good to Know

FAQ

What flavour of regex does this tool use?

The JavaScript (ECMAScript) engine — the same one your browser and Node.js run. Most patterns transfer straight to other engines such as PCRE, though a few advanced features differ.

Why does my pattern only match once?

Tick the g (Global) flag. Without it the engine stops at the first match instead of scanning the rest of the text.

What is the difference between greedy and lazy matching?

Greedy quantifiers (* and +) take as much text as they can; lazy quantifiers (*? and +?) take as little as possible. Both are valid — which one you want depends on where the match should stop.

Can I test patterns here that I will use in PHP or Python?

For core syntax, yes — most of it is shared. Always confirm in the real target environment, because features such as lookbehind and Unicode property escapes vary between flavours.

Why does ^ not match the start of every line?

By default ^ and $ anchor to the start and end of the whole string. Tick the m (Multiline) flag and they match at the start and end of each line instead.

What do the Index and Length columns mean?

Index is the zero-based position in the test text where the match begins, and Length is how many characters it spans. Copy Matches puts that same table — match, index and length — on your clipboard.

Is my pattern or test text sent anywhere?

No. Everything runs inside your browser and nothing is uploaded, logged or stored — watching the network while typing shows no requests leaving the page.

Related Tools

Base64 Encoder
Base64 Encoder

Encode or decode Base64 strings safely.

  • 100% Free
  • Customizable
  • Download
  • Unlimited
Hash Generator
Hash Generator

Generate MD5, SHA-1, SHA-256, and more hashes.

  • 100% Free
  • Customizable
  • Download
  • Unlimited
URL Encoder
URL Encoder

Escape and unescape URL components instantly.

  • 100% Free
  • Customizable
  • Download
  • Unlimited
HTML Encoder
HTML Encoder

Convert HTML entities to text and back.

  • 100% Free
  • Customizable
  • Download
  • Unlimited
JSON CSV Converter
JSON CSV Converter

Convert JSON arrays to CSV and back.

  • 100% Free
  • Customizable
  • Download
  • Unlimited
UUID Generator
UUID Generator

Create unique UUIDs for apps and databases.

  • 100% Free
  • Customizable
  • Download
  • Unlimited