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?

On Wed, Feb 9, 2011 at 4:54 AM, Ralph S. [email protected]
wrote:

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.
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.

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

On Fri, Feb 11, 2011 at 6:26 PM, Jatin kumar
[email protected]wrote:

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

On Fri, Feb 11, 2011 at 8:02 AM, Ralph S.
[email protected]wrote:

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs