title: how do I extract substring (group) using regex without knowing if regex matches?
body: <p>I want to use this</p>
  
  <pre><code>val r = """^myprefix:(.*)""".r
  val r(suffix) = line
  println(suffix)
  </code></pre>
  
  <p>But it gives an error when the string doesn't match. How do I use a similar construct where matching is optional? </p>
  
  <p>Edit: To make it clear, I need the group <code>(.*)</code></p>