Calculate mathematical operation stored in String using regex in Scala
<p>I want to evaluate mathematical expression stored in String and print the result.</p>

<p>I have to use Pattern matching in Scala.
I wrote this code below, but it does not work, it prints <code>false</code> instead of <code>2</code>.</p>

<p>Any help will be appreciated.</p>

<pre><code>object PatternMatcher{
    val s = "13 - 5 - 6"
    val Pattern = "((\\d+\\s[+-]\\s){1,10}(\\d+){0,1})".r

    def main(args: Array[String]) {
        println(matcher(s))
    }

    def matcher(choice: String): Any = choice match {
        case Pattern(choice) =&gt; choice
        case _ =&gt; "false"
    }
}
</code></pre>