você deve usar a correspondência "non capture" ?:para lidar com os sites não "http://"
Curti
select
id,
substring(website from '(?:.*://)?(?:www\.)?([^/]*)')
as website_domain
from contacts
http://sqlfiddle.com/#!17/197fb/14
https://www.postgresql.org /docs/9.3/static/functions-matching.html#POSIX-ATOMS-TABLE