Issue #16796 has been reported by UlyssesZhan (ͭ ).

----------------------------------------
Feature #16796: Assigning local variables when using `case when regexp`
https://bugs.ruby-lang.org/issues/16796

* Author: UlyssesZhan (ͭ )
* Status: Open
* Priority: Normal
----------------------------------------
I want to use
```ruby
case "str"
when /s(?<mid>.)r/
  p mid
end
```
instead of
```ruby
case
when /s(?<mid>.)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: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>