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