Test these patterns instantly in the Regex Tester.Open Regex Tool →
Regex Recipes
Common, production-ready regex patterns you can reuse across projects.
Common Patterns
| Key / Code | Description |
|---|---|
| ^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$ | |
| URL | https?:\/\/[\w.-]+(?:\/[\w./?%&=-]*)? |
| IPv4 | ^(?:\d{1,3}\.){3}\d{1,3}$ |
| UUID v4 | ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$ |
| ISO Date | ^\d{4}-\d{2}-\d{2}$ |
| Hex Color | ^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$ |
Text Utilities
| Key / Code | Description |
|---|---|
| Slug | ^[a-z0-9]+(?:-[a-z0-9]+)*$ |
| SemVer | ^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$ |
| Base64 | ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ |
Tips
Regex is context-sensitive. Always validate against your inputs and consider escaping for your runtime (JS, Python, Go).
Knowledge is power.