Method: MatchData#offset
- Defined in:
- re.c
#offset(n) ⇒ Array #offset(name) ⇒ Array
:include: doc/matchdata/offset.rdoc
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 |
# File 're.c', line 1249
static VALUE
match_offset(VALUE match, VALUE n)
{
int i = match_backref_number(match, n);
struct re_registers *regs = RMATCH_REGS(match);
match_check(match);
backref_number_check(regs, i);
if (BEG(i) < 0)
return rb_assoc_new(Qnil, Qnil);
update_char_offset(match);
return rb_assoc_new(LONG2NUM(RMATCH_EXT(match)->char_offset[i].beg),
LONG2NUM(RMATCH_EXT(match)->char_offset[i].end));
}
|