How to get domain from a string using javascript regular expression
问题 As the title suggests, I'm trying to retrieve the domain from a string using javascript regular expression. Take the following strings: String ==> Return "google" ==> null "google.com" ==> "google.com" "www.google.com" ==> "www.google.com" "ftp://ftp.google.com" ==> "ftp.google.com" "http://www.google.com" ==> "www.google.com" "http://www.google.com/" ==> "www.google.com" "https://www.google.com/" ==> "www.google.com" "https://www.google.com.sg/" ==> "www.google.com.sg" "https://www.google