← Back to tools

Regex Cheat Sheet

Quick reference for regular expressions. Search any pattern or concept.

Regular expressions (regex) are one of the most powerful tools in a developer's toolkit, but they have a reputation for being cryptic. The key is to learn them in layers: start with literal characters, add character classes (\d, \w), then quantifiers (*, +, {n}), and finally groups and lookaheads.

The most common mistake is writing overly complex patterns when simple ones would work. For example, validating an email doesn't need a 500-character RFC-compliant regex — /^[^\s@]+@[^\s@]+\.[^\s@]+$/ covers 99.9% of real-world emails. Start simple, test with real data, and add complexity only when needed.

Performance matters for regex in production code. Catastrophic backtracking occurs when a pattern has nested quantifiers that can match the same input in exponentially many ways — like (a+)+ on a string of a's. Use atomic groups or possessive quantifiers when available, and always test your patterns against edge cases and long inputs.

This tool in other languages:

Français:
Aide-mémoire regex

Español:
Hoja de referencia regex

Deutsch:
Regex-Spickzettel

Português:
Folha de referência regex

日本語:
正規表現チートシート

中文:
正则表达式速查表

한국어:
정규식 치트 시트

العربية:
ورقة مرجعية للتعبيرات النمطية