musíte použít "non capturing" match ?:abyste se vyrovnali s weby, které nejsou "https://"
jako
select
id,
substring(website from '(?:.*://)?(?:www\.)?([^/]*)')
as website_domain
from contacts
https://sqlfiddle.com/#!17/197fb/14
https://www.postgresql.org /docs/9.3/static/functions-matching.html#POSIX-ATOMS-TABLE