I have tried the regex from this question : how to get domain name from URL
But the domain name is not being found. Here is my implementation :
val Names = """.*([^\.]+)(com|net|org|info|coop|int|co\.uk|org\.uk|ac\.uk|uk|__and so on__)$""".r
val s = Names.findFirstIn("www.google.com")
s match {
case Some(name) =>
println(name)
case None =>
println("No name value")
}
"No name value" is consistently printed to std out. Is there an issue with the regex or my Scala implementation ?