Similar to Is Java Regex Thread Safe?, I would like to know if this usage of scala regex is really thread safe? Are multiple threads able to call m on the same object M without interfering with each other in the result?
object R {
val pat = """a(\d)""".r
}
class M {
def m(s: String): Option[Int] = {
s match {
case R.pat(i) => Some(i.toInt)
case _ => None
}
}
}