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)
.
To contact me, send an email anytime or leave a comment below.