Issue #21932 has been updated by Eregon (Benoit Daloze). I think returning 0 when the group isn't parseable as a number seems bad behavior. At least if I would use this method, I would expect two things of it: * It returns the Integer value of that group, without needing `Integer($N)` * It fails if the capture isn't a number, like Kernel#Integer Does anyone have a use case for returning 0 when the group isn't a number? It just seems like a "broken data" situation for no reason when e.g. using the wrong group number. ---------------------------------------- Feature #21932: `MatchData#get_int` https://bugs.ruby-lang.org/issues/21932#change-116771 * Author: nobu (Nobuyoshi Nakada) * Status: Open ---------------------------------------- This is suggested by @akr today, `$~.get_int(1)` is equivalent to `$1.to_i` but does not create the intermediate string object. https://github.com/nobu/ruby/tree/match-get_int -- https://bugs.ruby-lang.org/