Scala Regex is so Easy!
In scala you can use .r
operator to create a regex from string. It becomes trivial:
val speech = """Four score and
|seven years ago""".stripMargin
val pattern = "\\w+".r
pattern.findFirstIn(speech);
prints Some(Four)
.
Thanks! You can always email me or use contact form for more questions/comments etc.