On Mon, Dec 08, 2008 at 08:52:46AM -0800, John Hardin wrote: > On Mon, 8 Dec 2008, Dennis Hardy wrote: > >> What I would like to match on is URLs that do _not_ start with a third level >> domain entry, and end with ".com", ".biz", ".info", etc. For example, >> "http://hello.com/" (followed by more stuff) would match, and >> "http://www.hello.com/{...}" would _not_ match. >> >> Some of the "dot only" checks I tried: >> >> (?<!\.)\w+?\.com >> ([^\.])\w+.*\.com\/ >> >> Again none of these work :-( > > How about: > /:\/\/[^.\/]+\.[^\.\/]+\//
To be more specific: Hostname may end optionally to a dot, with :port, /slash or nothing following m{^https?://[^.:/]+\.[^.:/]+\.?(?:$|[:/])}