title: Unpack all groups from regex match
body: <p>There is a very nice way to unpack matched groups from regex:</p>
  
  <pre><code>scala&gt; val regex = "(first):(second)".r
  regex: scala.util.matching.Regex = (first):(second)
  
  scala&gt; val regex(a, b) = "first:second"
  a: String = first
  b: String = second
  </code></pre>
  
  <p>Unfortunately, this throws exception when there is no match:</p>
  
  <pre><code>scala&gt; val regex(a, b) = "first:third"
  scala.MatchError: first:third (of class java.lang.String)
          at .&lt;init&gt;(&lt;console&gt;:10)
          at .&lt;clinit&gt;(&lt;console&gt;)
          at .&lt;init&gt;(&lt;console&gt;:11)
          at .&lt;clinit&gt;(&lt;console&gt;)
          at $print(&lt;console&gt;)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
          at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920)
          at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
          at scala.tools.nsc.io.package$$anon$2.run(package.scala:25)
          at java.lang.Thread.run(Thread.java:744)
  </code></pre>
  
  <p>In this case I could use <code>findFirstMatchIn</code> to get <code>None</code> is there is no match:</p>
  
  <pre><code>scala&gt; val result = regex.findFirstMatchIn("first:third")
  result: Option[scala.util.matching.Regex.Match] = None
  </code></pre>
  
  <p>But in case of match, I want to have something as good as the first variant with unpacking. Now I have to deal with this:</p>
  
  <pre><code>scala&gt; val result = regex.findFirstMatchIn("first:second")
  result: Option[scala.util.matching.Regex.Match] = Some(first:second)
  </code></pre>
  
  <p>What I came up with is this:</p>
  
  <pre><code>scala&gt; val content = result.get
  content: scala.util.matching.Regex.Match = first:second
  
  scala&gt; 1 to content.groupCount map content.group
  res0: scala.collection.immutable.IndexedSeq[String] = Vector(first, second)
  </code></pre>
  
  <p>Is there any better way to get all groups from regex match object (ideally as succinct as unpacking in the first code snippet in this question)? </p>