📚Dev Reference

Regex Cheat Sheet

Essential metacharacters for pattern matching.

Explanation

Regular expressions are powerful but hard to remember. This reference covers the basics.

Examples

Digit
Output
\d
Whitespace
Output
\s

Code Examples

Basics
.   - Any character
\w  - Word [a-zA-Z0-9_]
\d  - Digit [0-9]
\s  - Whitespace [ \t\n]
^   - Start of line
$   - End of line
*   - 0 or more
+   - 1 or more

Try it Now

💡 Tips

  • Use case-insensitive flags (/i) when appropriate
  • Escape special characters with a backslash (e.g., \.)
  • Start simple and build up your pattern

⚠️ Common Pitfalls

  • Overly complex regex is hard to read and maintain