Justin sent over a regex he wrote for catching the various bits of a url: (http|ftp):\/\/((?:[^./]+\.){1,}(?:[^./]+))((?:/[^/]+)*/)([^/]+)\.([^./]+)