URL
Validate http, https, and ftp URLs
URL
The url rule checks that a value is a valid absolute URL with an explicit scheme.
What it checks
A string starting with http://, https://, or ftp://, followed by a non-empty host, with no whitespace:
/^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/iConfig flag
validationSchema: {
website: { url: true },
}With a custom message:
website: { url: "Enter a valid URL" }V builder
import { V } from "formify-js";
V.url() // default message
V.url("Enter a valid URL")Default message
Please enter a valid URL
Things to know
- Empty values pass unless
required: trueis also set. - Only
http,https, andftpschemes are accepted — protocol-relative URLs (//example.com) fail.