View Problem

Check if a string matches with groups

Display "two" if "one two three" matches /one (.*) three/
ExpandDiskEdit
scala
val m = Pattern.compile("one (.*) three").matcher("one two three")
if (m.matches) println(m.group(1))

Submit a new solution for scala
There are 12 other solutions in additional languages (cpp, csharp, erlang, fsharp ...)