From: naruse@... Date: 2016-02-16T09:25:16+00:00 Subject: [ruby-core:73834] [Ruby trunk Bug#11991][Assigned] `Symbol#match` returns the match position, unlike `String#match` and `Regexp#match` Issue #11991 has been updated by Yui NARUSE. Status changed from Open to Assigned Assignee set to Nobuyoshi Nakada Considered a bug but for compatibility this shouldn't be backported. 2.4 will introduce incompatibility. ---------------------------------------- Bug #11991: `Symbol#match` returns the match position, unlike `String#match` and `Regexp#match` https://bugs.ruby-lang.org/issues/11991#change-57010 * Author: Tsuyoshi Sawada * Status: Assigned * Priority: Normal * Assignee: Nobuyoshi Nakada * ruby -v: * Backport: 2.0.0: WONTFIX, 2.1: WONTFIX, 2.2: WONTFIX, 2.3: WONTFIX ---------------------------------------- `String#match` and `Regexp#match` return a `MatchData` when match succeeds: ~~~RUBY "".match(//) # => # //.match("") # => # //.match(:"") # => # ~~~ But `Symbol#match` returns the match position (like `String#=~`): ~~~RUBY :"".match(//) # => 0 ~~~ Thus, `Symbol#match` behaves differently from `String#match` and `Regexp#match`. This is the documented behavior, but it may be a bug (together with the documentation). On the other hand, if it is not a bug, what is the rationale? -- https://bugs.ruby-lang.org/ Unsubscribe: