[ruby-dev:48432] [ruby-trunk - Bug #9902] Regexp#[] ignores after NUL byte in named capture index
From:
nagachika00@...
Date:
2014-07-18 17:16:29 UTC
List:
ruby-dev #48432
Issue #9902 has been updated by Tomoyuki Chikanaga.
Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.=
1: DONE
backported into `ruby_2_1` branch at r46869.
----------------------------------------
Bug #9902: Regexp#[] ignores after NUL byte in named capture index
https://bugs.ruby-lang.org/issues/9902#change-47867
* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee:=20
* Category:=20
* Target version:=20
* ruby -v: r46343
* Backport: 2.0.0: REQUIRED, 2.1: DONE
----------------------------------------
Regexp#[]=E3=81=AB"\0"=E3=82=92=E5=90=AB=E3=82=80=E6=96=87=E5=AD=97=E5=88=
=97=E3=82=84=E3=82=B7=E3=83=B3=E3=83=9C=E3=83=AB=E3=82=92=E6=8C=87=E5=AE=9A=
=E3=81=97=E3=81=9F=E3=81=A8=E3=81=8D=E3=80=81=E3=81=9D=E3=82=8C=E4=BB=A5=E9=
=99=8D=E3=81=8C=E7=84=A1=E8=A6=96=E3=81=95=E3=82=8C=E3=81=BE=E3=81=99=E3=80=
=82
~~~
$ ruby -w -e 'p(/(?<a>.*)/.match("foo")["a\0foo"])'
"foo"
$ ruby -w -e 'p Regexp.new("(?<foo\0bar>.*?)").match("xxx")["foo\0bar"]'
-e:1:in `[]': undefined group name reference: foo (IndexError)
from -e:1:in `<main>'
~~~
--=20
https://bugs.ruby-lang.org/