title: scala regex multiple integers
body: <p>I have the following string that I would like to match on: <code>1-10 employees</code>. </p>
  
  <p>Here is my regex statement <code>val regex = ("\\d+").r</code></p>
  
  <p>The problem I have is Im trying to find a way to extract the matched data and determine which value returned is bigger. </p>
  
  <p>Here is what IM doing to process it</p>
  
  <pre><code>  def setMinAndMaxValue(currentCompany: CurrentCompany, matchIterator: Iterator[Regex.Match]): CurrentCompany = {
      var max = 0
      println(s"matchIterator - $matchIterator")
      matchIterator.collect {
        case regex(s: String) =&gt; println("found string")
        case regex(IntConv(x)) =&gt;
          println("regex case")
          if (x &gt; max) max = x
      }
      val (minVal, maxVal) = rangesForMaxValue(max)
      val newDetails = currentCompany.details.copy(minSize = Some(minVal), maxSize = Some(maxVal))
      currentCompany.copy(details = newDetails)
    }
  
  object IntConv {
    def unapply(s : String) : Option[Int] = Try {
      Some(s.toInt)
    }.toOption.flatten
  }
  </code></pre>