In Ruby I can replace characters in a string in the following way:
a = \"one1two2three\" a.gsub(/\\d+/) {|e| e.to_i + 1} => \"one2two3three\"
Yes, Regex#replaceAllIn has an overloaded version that takes a function Match => String. The equivalent Scala version of your code would be:
Regex#replaceAllIn
Match => String
"""\d+""".r.replaceAllIn("one1two2three", m => (m.group(0).toInt + 1).toString)