looping through scan and replacing matches individually
I would like to loop through regex matches and replace each match
individually in the loop.
For example:
content.scan(/myregex/).each do |m|
m = 'new str'
end
How could I do that?
The reason why I want to do that is because each match will be replaced
with a different output from a function.
Thanks for help
No comments:
Post a Comment