fork(4) download
  1. object Main extends App {
  2. val text = """this is line 1
  3.  
  4. ------------------------------
  5.  
  6. this is line 2
  7.  
  8. +++++++++++++++++++++++++
  9.  
  10. this is line 3
  11.  
  12. ---------------
  13.  
  14. this is line 4"""
  15. val rx = """(?m)\s*^(\++|-+)$\s*"""
  16. val res = text.split(rx)
  17. print(res.toList)
  18. }
Success #stdin #stdout 0.4s 4382720KB
stdin
Standard input is empty
stdout
List(this is line 1, this is line 2, this is line 3, this is line 4)