Like gsub but the parameter is matchdata

Is there a mechanism in Ruby that works like

  gsub {|x| something}

where x is MatchData instead of String?

Is there a mechanism in Ruby that works like

gsub {|x| something}

where x is MatchData instead of String?

Check this out.

http://www.ruby-doc.org/core/classes/String.html#M001186

Check this out.

class String - RDoc Documentation

I must be blind. I see no MatchData anywhere.

I see *match* which is a string ... but no MatchData.

Check this out.

http://www.ruby-doc.org/core/classes/String.html#M001186

I must be blind. I see no MatchData anywhere.

I see match which is a string … but no MatchData.

What exactly do you mean when you say MatchData and not a string. Can you show a dummy example of what do you want to achieve.

i think what he meant was like the scan function for string but instead of returning String objects, you get MatchData objects.