Back to Developer Tools

Regex Tester – Test Patterns Instantly

Debug and perfect your regular expressions with real feedback

Common Patterns

Enter regex pattern

This tester uses JavaScript (ECMAScript) regex syntax.

Current flags: g

Quick Start with Regex

Choose a pattern from the common ones above, or type your own. Add flags like 'i' for case-insensitive matching, then paste some text to test against. Click "Test Regex" to see what matches.

Start simple: Try \d+ to match numbers in text
Use flags: Add 'i' to make patterns case-insensitive, 'g' to find all matches
Test thoroughly: Paste real examples and edge cases to see if your pattern behaves as expected

When I first encountered regular expressions, they looked like someone had mashed a keyboard. But once it clicked, I realized they're just a precise way to describe patterns in text. Think of regex as a mini-language specifically designed to answer one question: "Does this text contain a pattern that looks like X?"

The Building Blocks

Regular expressions work by combining simple rules. Here are the most fundamental ones:

Single Characters

aMatches exactly 'a'
\\dAny digit (0-9)
\\wWord character (letter, number, _)
.Any single character

Quantifiers (How Many?)

*Zero or more times
+One or more times
?Zero or one time
{3}Exactly 3 times

Why Regex Feels Confusing at First

The syntax is dense—it packs a lot of meaning into few characters. \\d3-\\d2-\\d4 looks cryptic, but it's just "three digits, hyphen, two digits, hyphen, four digits." The backslashes escape special characters, and the curly braces specify counts.

Tip from experience: Don't try to write complex patterns from scratch. Start with what you want to match in plain English, then translate piece by piece. Want phone numbers? "Three digits, maybe parentheses, maybe spaces or hyphens, three digits, maybe space or hyphen, four digits." That mental translation is the key.

Where Regex Comes From

Regular expressions originated in theoretical computer science in the 1950s, but their practical use exploded with text editors and Unix tools in the 1970s. Today, nearly every programming language includes regex support, though implementations vary slightly. The patterns you create here follow JavaScript's regex engine, which is pretty standard and works similarly in most modern languages.