fork download
  1. object Main extends App {
  2. val myregex = "This is a (.*) text for(?: (.*))? and other thing like .*".r
  3. val x = "This is a test text for and other thing like blah blah"
  4. x match {
  5. case myregex(a, b) => print(s"${a} -- ${b}");
  6. case _ => print("none")
  7. }
  8. }
Success #stdin #stdout 0.38s 4382720KB
stdin
Standard input is empty
stdout
test -- null