зеркало из https://github.com/github/ruby.git
prohibit number backref in replaced string for named pattern
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f69c1f18ee
Коммит
50091c990d
|
@ -1,3 +1,8 @@
|
|||
Thu Mar 23 21:40:47 2006 K.Kosako <sndgk393 AT ybb.ne.jp>
|
||||
|
||||
* re.c (rb_reg_regsub): prohibit \1, \2 ...\9 in replaced string
|
||||
for named regex pattern.
|
||||
|
||||
Thu Mar 23 21:06:23 2006 K.Kosako <sndgk393 AT ybb.ne.jp>
|
||||
|
||||
* oniguruma.h: Version 4.0.2
|
||||
|
|
10
re.c
10
re.c
|
@ -2055,9 +2055,14 @@ rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs, VALUE regexp)
|
|||
uc = (unsigned char)*s++;
|
||||
p = s;
|
||||
switch (uc) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
no = uc - '0';
|
||||
if (onig_noname_group_capture_is_active(RREGEXP(regexp)->ptr)) {
|
||||
no = uc - '0';
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
|
@ -2083,6 +2088,7 @@ rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs, VALUE regexp)
|
|||
rb_str_buf_cat(val, s-2, 2);
|
||||
continue;
|
||||
|
||||
case '0':
|
||||
case '&':
|
||||
no = 0;
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче