title: Split up a list at each element satisfying a predicate (Scala)
body: <p>In a text file I have data in the form:</p>
  
  <pre><code>1)
  text
  text
  2)
  more text
  3)
  even more text
  more even text
  even more text
  ...
  </code></pre>
  
  <p>I read it as a list of Strings using the following:</p>
  
  <pre><code>val input = io.Source.fromFile("filename.txt").getLines().toList
  </code></pre>
  
  <p>I want to break the list down into sub-lists starting with <code>1)</code>, <code>2)</code> etc.</p>
  
  <p>I've come up with:</p>
  
  <pre><code>val subLists =
    input.foldRight( List(List[String]()) ) {
      (x, acc) =&gt;
        if (x.matches("""[0-9]+\)""")) List() :: (x :: acc.head) :: acc.tail
        else (x :: acc.head) :: acc.tail
    }.tail
  </code></pre>
  
  <p>Can this be achieved more simply? What would be really nice would be if there were a built-in method to split a collection on every element that satisfies a predicate (hint, hint, library designers :)).</p>