I have been looking around for a regex expression that will spit out just the 'stackoverflow' part and no www. or .com etc. All I could find was to check if the url's were valid... I have used php's url filter to determine that much I now am looking to determine which site it is.
I have never written an expression before so I am hoping someone can check it/recommend a better solution.
preg_match('@^(?:http://)(?:www.)?([^.]+)@i', $url, $matches)
edit: All the url's I am dealing with are .com if that helps