Regex Library
Browse common regular expression patterns — copy and test instantly
Email Address
email^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$Matches a standard email address with local part, @ symbol, domain, and TLD.
URL (http/https)
url^https?://[a-zA-Z0-9][a-zA-Z0-9.\-]*\.[a-zA-Z]{2,}(/[^\s]*)?$ /iMatches HTTP and HTTPS URLs with a valid hostname.
Phone E.164
phone^\+[1-9]\d{1,14}$Matches international phone numbers in E.164 format (e.g. +14155552671).
Date YYYY-MM-DD
date^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$Matches dates in ISO 8601 date format YYYY-MM-DD.
ISO Datetime
date^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$Matches ISO 8601 datetime strings with optional fractional seconds and timezone.
Integer
number^-?\d+$Matches positive or negative integers.
Decimal Number
number^-?\d+(\.\d+)?$Matches positive or negative decimal numbers.
UUID v4
id^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ /iMatches a UUID version 4 string (random, RFC 4122).
Hex Colour
misc^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$Matches CSS hex colour values in 3 or 6 digit form.
IPv4 Address
network^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$Matches a valid IPv4 address with values 0-255 in each octet.
Slug
misc^[a-z0-9]+(?:-[a-z0-9]+)*$Matches a URL slug: lowercase letters, digits, and hyphens (no leading/trailing hyphens).
Semantic Version
misc^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$Matches a Semantic Versioning (semver) string.