Skip to main content
Formats of the internet, checked on strings. They check the shape of the value, without network access: email() does not send an email, and jwt() does not verify a signature.
Webhook.kt

Addresses

email

email() on String Checks that the string is an email address: a local part, @ and a domain with at least one dot. Quoted local parts and IP address domains are not accepted. email

url

url(schemes) on String Checks that the string is an absolute URL with one of schemes and a host. url

hostname

hostname() on String Checks that the string is a hostname: labels of letters, digits and dashes, separated by dots, at most 253 characters. A single label, such as localhost, passes. hostname

domain

domain() on String Checks that the string is a domain name with at least two labels and a top-level domain of letters or punycode, such as example.com. domain

port

port() on Int, String Checks that the number is a port number, from 0 to 65535. port

Networks

ip

ip() on String Checks that the string is an IPv4 or an IPv6 address. See ipv4 and ipv6 for what each accepts. ip

ipv4

ipv4() on String Checks that the string is an IPv4 address in dotted decimal, such as 192.168.0.1, with no leading zeros. ipv4

ipv6

ipv6() on String Checks that the string is an IPv6 address, such as 2001:db8::1, with :: compression and an embedded IPv4 address accepted. A zone, such as %eth0, is not accepted. ipv6

cidr

cidr() on String Checks that the string is a CIDR block: an IPv4 or IPv6 address, / and a prefix length that fits it, such as 10.0.0.0/8. cidr

macAddress

macAddress() on String Checks that the string is a MAC address: six pairs of hexadecimal digits, separated all by : or all by -. macAddress

Web formats

slug

slug() on String Checks that the string is a slug: lowercase letters and digits in groups joined by single dashes, such as hello-world-2. slug

jwt

jwt() on String Checks that the string has the format of a JWT: three Base64URL parts separated by dots, the last of which can be empty. Only the format is checked. The signature is not verified. jwt

dataUri

dataUri() on String Checks that the string is a data: URI, such as data:image/png;base64,iVBORw0KGgo=. dataUri

mimeType

mimeType() on String Checks that the string is a MIME type of a registered top-level type, such as application/json or image/svg+xml. Parameters, such as ; charset=utf-8, are not accepted. mimeType