summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-01 09:18:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-01 09:18:11 +0000
commit5c3523de765b41584cfcebb8aebbaa6ac9433c35 (patch)
tree6f7bcd6f2beee4a3061b59e5885efed0605edb00 /re.c
parent87b67b575c4d5dc428ee1f33f0f4d546e5111c10 (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/re.c b/re.c
index 647f17b..eeb89cf 100644
--- a/re.c
+++ b/re.c
@@ -777,14 +777,7 @@ match_aref(argc, argv, match)
if (!NIL_P(rest) || !FIXNUM_P(idx) || FIX2INT(idx) < 0) {
return rb_ary_aref(argc, argv, match_to_a(match));
}
-
- regs = RMATCH(match)->regs;
- i = FIX2INT(idx);
-
- if (i >= regs->num_regs) return Qnil;
-
- ptr = RSTRING(RMATCH(match)->str)->ptr;
- return rb_str_new(ptr+regs->beg[i], regs->end[i]-regs->beg[i]);
+ return rb_reg_nth_match(FIX2INT(idx), match);
}
static VALUE