If I do “abc”.gsub(/a(b)c/) { | matched |
}
I realize it’s a bit painful but I kind of expected it to pass MatchData to the block. Is there a way to get the MatchData or matched groups?
If I do “abc”.gsub(/a(b)c/) { | matched |
}
I realize it’s a bit painful but I kind of expected it to pass MatchData to the block. Is there a way to get the MatchData or matched groups?
pp "abc".match(/a(b)c/) # => Regex::MatchData("abc" 1:"b")