Comprehensive collection of regex patterns commonly used in web and mobile app development.
Basic email validation
^[^\s@]+@[^\s@]+\.[^\s@]+$
Simple URL validation
^(https?:\/\/)?([\w-]+\.)+[\w-]+(\/[\w- .?%&=]*)?$
URL with required protocol
^https?:\/\/[\w\-]+(\.[\w\-]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?$
IPv4 address validation
^(25[0-5]|2[0-4]\d|[01]?\d\d?)(\.(25[0-5]|2[0-4]\d|[01]?\d\d?)){3}$
IPv6 address validation
^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$
HEX color code
^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$
RGB color format
^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$
RGBA color with alpha
^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([01]?\.\d+|0|1)\s*\)$
URL-friendly slug
^[a-z0-9]+(?:-[a-z0-9]+)*$
Username 3-16 chars, alphanumeric + underscore
^[a-zA-Z0-9_]{3,16}$
Password with uppercase, lowercase, number, special char
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
US phone number format
^\+?1?[-.\s]?\(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4})$