An extractor object that yields the groups in the match. Using an extractor
rather than the original regex avoids recomputing the match.
import scala.util.matching.Regex.Groups
val datePattern = """(\d\d\d\d)-(\d\d)-(\d\d)""".r
val text = "The doc spree happened on 2011-07-15."val day = datePattern replaceAllIn(text, _ match { case Groups(year, month, day) => month+"/"+day })
An extractor object that yields the groups in the match. Using an extractor rather than the original regex avoids recomputing the match.