My scala version 2.7.7
I am trying to extract an email address from a larger string. the string itself does not match the format. The code I have is:
import scala.util.matching.Regex import scala.util.matching._ val Reg = """\b[A-Z0-9._%+-] +@ [A-Z0-9.-]+\.[AZ]{2,4}\b""".r "yo my name is joe : joe@gmail.com " match { case Reg(e) => println("match: " + e) case _ => println("fail") }
Regex goes into RegExBuilder but fails for scala. Also, if there is another way to do this without regular expression, that would be fine too. Thanks!
source share