title: How to test if Scala combinator parser matches a string
body: <p>I have a Scala combinator parser that handles comma-delimited lists of decimal numbers.</p>
  
  <pre><code>object NumberListParser extends RegexParsers {
    def number: Parser[Double] = """\d+(\.\d*)?""".r ^^ (_.toDouble)
  
    def numbers: Parser[List[Double]] = rep1sep(number, ",")
  
    def itMatches(s: String): Boolean = parseAll(numbers, s) match {
      case _: Success[_] =&gt; true
      case _ =&gt; false
    }
  }
  </code></pre>
  
  <p>The <code>itMatches</code> function returns <code>true</code> when given a string that matches the pattern. For example:</p>
  
  <pre><code>NumberListParser.itMatches("12.4,3.141") // returns true
  NumberListParser.itMatches("bogus") // returns false
  </code></pre>
  
  <p>Is there a more terse way to do this? I couldn't find one in the documentation, but my function sees a bit verbose, so I wonder if I'm overlooking something.</p>