From: matz@... Date: 2020-04-18T12:48:14+00:00 Subject: [ruby-core:97949] [Ruby master Feature#16796] Assigning local variables when using `case when regexp` Issue #16796 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected Implicit assignment from regular expression matches has been a bad idea. I shouldn't have merged it at the first moment. I'd like to remove it altogether if I have a chance. So I don't like to enhance it any further. Matz. ---------------------------------------- Feature #16796: Assigning local variables when using `case when regexp` https://bugs.ruby-lang.org/issues/16796#change-85173 * Author: UlyssesZhan (������ ���) * Status: Rejected * Priority: Normal ---------------------------------------- I want to use ```ruby case "str" when /s(?.)r/ p mid end ``` instead of ```ruby case when /s(?.)r/ =~ "str" p mid end ``` I also do not like using `$1`. This feature is extremely useful when there are a lot of `when`s. -- https://bugs.ruby-lang.org/ Unsubscribe: