Regular Expressions

Pattern matching for text—the Swiss Army knife of data cleaning

What are Regular Expressions?

Regular expressions (regex) are patterns used to match character combinations in text. They're essential for finding, extracting, and replacing text patterns—from email addresses to phone numbers to complex data formats.

Type a pattern below and watch matches highlight in real time!

/ /
0 matches found

Pattern Breakdown

This pattern matches email addresses.

Greedy vs Lazy

By default, quantifiers are greedy (match as much as possible). Add ? after to make lazy: .*? matches as little as possible.

Escaping Special Characters

Characters like . * + ? [ ] ( ) { } | \ ^ $ have special meanings. Use \ to match them literally: \. matches a period.

Character Sets

[abc] matches a, b, or c. [a-z] matches any lowercase letter. [^abc] matches anything except a, b, c.

Capture Groups

Parentheses () create groups you can reference later. In (\d{3})-(\d{4}), group 1 is area code, group 2 is number.