In Ruby there is a way to replace occurences of a given regular expression with the value returned by a callback.
For example: s.gsub(/^\d+(\w+)\d+/) { |m| m.upcase } Run which basically takes every "word", surrounded by digits, passes it to the callback function, gets it uppercased and replaces the original. How can I do something like that in Nim?