I have a rather simple regexp, but I wanted to use named regular expressions to make it cleaner and then iterate over results.
Testing string:
testing_s
If you want to keep the names, you can do
new_dimensions = {} dimensions.names.each { |k| new_dimensions[k] = my_operation(dimensions[k]) }