fork download
  1. object Main extends App {
  2. val s = "name type this comment a comment"
  3. val nameType = """(\w+)\s+(\w+)\s+(.*)""".r
  4. val res = s match {
  5. case nameType(n, t, c) => print(n,t,c)
  6. case _ => print("NONE")
  7. }
  8. }
Success #stdin #stdout 0.15s 322496KB
stdin
Standard input is empty
stdout
(name,type,this comment a comment)