Actions
Feature #10123
closedNamed capture groups don't set local vars when matched using ~
Feature #10123:
Named capture groups don't set local vars when matched using ~
Status:
Rejected
Assignee:
-
Target version:
-
Description
Broken when using ~
:
$ echo ' josh' | ruby -ne '~/(?<initial>\w)/ and puts initial'
-e:1:in `<main>': undefined local variable or method `initial' for main:Object (NameError)
Working when using =~ $_
:
$ echo ' josh' | ruby -ne '/(?<initial>\w)/ =~ $_ and puts initial'
j
Actions