[#77789] [Ruby trunk Feature#12012] Add Boolean method — prodis@...
Issue #12012 has been updated by Fernando Hamasaki de Amorim.
4 messages
2016/10/27
[ruby-core:77724] [Ruby trunk Bug#12862] Regular Expression Named Group Matching does not work with #{} (Similar? to issue #2778)
From:
shyouhei@...
Date:
2016-10-23 11:22:58 UTC
List:
ruby-core #77724
Issue #12862 has been updated by Shyouhei Urabe.
Description updated
----------------------------------------
Bug #12862: Regular Expression Named Group Matching does not work with #{} (Similar? to issue #2778)
https://bugs.ruby-lang.org/issues/12862#change-61005
* Author: Leo Amigud
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Loading development environment (Rails 4.2.5)
```
irb(main):001:0> /\$(?<dollars>\d+)\.(?<cents>\d+)/ =~ "$3.67"
=> 0
irb(main):002:0> dollars
=> "3"
```
BUT:
```
irb(main):001:0> numbers = '\d+'
=> "\\d+"
irb(main):002:0> /\$(?<dollars>#{numbers})\.(?<cents>\d+)/ =~ "$3.67"
=> 0
irb(main):003:0> dollars
NameError: undefined local variable or method `dollars' for main:Object
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>