Here is one of the many check expressions I've tried:
(url::text ~* 'https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,255}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)'::text)
Which never works.
And yet oddly enough this does (for email validation):
(email::text ~* '^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+[.][A-Za-z]+$'::text)
I'm not sure what the difference between these two check expressions is, though I'd love to know.
So how can I validate a URL via a check constraint in Postgres?