I just needed a simple stored procedure to extract the hostname from any given URL. So here is what I came up with.
CREATE OR REPLACE FUNCTION getHostFromUrl(p_url character varying) RETURNS character varying AS $BODY$ declare begin return substring(p_url from 'http.?://(.*?)/(.*)'); end; $BODY$ LANGUAGE 'plpgsql' VOLATILE COST 100;
#1 by Kelly Brown on June 12th, 2009
I really like your post. Does it copyright protected?
#2 by jens on June 12th, 2009
thanks,
and use it however you want.
#3 by KonstantinMiller on July 6th, 2009
Hello, can you please post some more information on this topic? I would like to read more.