HandyTools Hub

Regex Tester

Test and debug regular expressions with real-time matching and highlighting.

/ /
Matches will be highlighted here...

Match Results

0 matches

No matches found.

Try it with a real match

Test a repeated word

Pattern and test text

\b(\w+)\s+\1\b
This is is a test

Matched text

is is

A matching pattern is not validation by itself

Test representative valid and invalid inputs before relying on a regular expression in production.

Read the regex starter guide

A regular expression tester lets you write a pattern, feed it sample text, and see exactly what matches — before the regex goes anywhere near production code. Built for developers, data analysts, and anyone who has stared at an expression like \b\w+@\w+\.\w+\b wondering why it fails, it updates matches in real time so you can iterate instead of guessing.

What is a Regular Expression?

A regular expression is a compact notation for describing patterns in text. The idea dates back to mathematician Stephen Kleene’s work in the 1950s, and entered everyday computing through Ken Thompson’s Unix tools like grep. Today every major language ships a regex engine, and while flavors differ, the building blocks — character classes, quantifiers, groups, anchors — are nearly universal. Regex shines at validating structured strings, extracting data from logs, and pattern-based find-and-replace; it is a famously poor fit for parsing nested structures like HTML.

How to Use

  • Enter pattern: Type your regular expression pattern
  • Add test string: Enter text to match against
  • View matches: See highlighted matches in real-time
  • Check groups: View capture groups and match details

Features

  • Real-time regex matching
  • Match highlighting
  • Capture group display
  • Support for flags (g, i, m, s)

Tips for Writing Better Regex

The most common beginner mistake is greediness: .* consumes as much as possible, so ".*" applied to say "hi" and "bye" matches everything between the first and last quote. Use the lazy variant .*? when you want the shortest match. Second, watch out for catastrophic backtracking — nested quantifiers like (a+)+ can freeze the engine on non-matching input. Third, escape special characters: a literal dot is \., which is why \d+\.\d+\.\d+\.\d+ matches IP addresses while the unescaped version matches almost anything.

Use Cases

Developers use this tester to build form validation patterns, craft search expressions for log analysis, and debug capture groups before wiring them into code. It is equally handy for one-off jobs like extracting every URL from a block of text.

Frequently Asked Questions

What regex flavors are supported?

JavaScript (ECMAScript) regex, the most widely used flavor in web development.

How do I use flags?

Add flags after the closing slash, like /pattern/gi for global and case-insensitive matching.

What is a capture group?

Parentheses in a pattern capture the matched substring, so you can extract parts of a match, like the area code from a phone number.

Why does my dot not match line breaks?

In JavaScript, the dot matches any character except line terminators by default. Add the s (dotAll) flag to make it match newlines too.