fork(2) download
  1. object Main extends App {
  2. val text = """This is a "very complex" test"""
  3. val p = "\"([^\"]*)\"|[^\"\\s]+".r
  4. val allMatches = p.findAllMatchIn(text).map(
  5. m => if (m.group(1) != null) m.group(1) else m.group(0)
  6. )
  7. println(allMatches.mkString("\n"))
  8. }
Success #stdin #stdout 0.4s 4382720KB
stdin
Standard input is empty
stdout
This
is
a
very complex
test