Method: MatchData#begin

Defined in:
re.c

#begin(n) ⇒ Integer #begin(name) ⇒ Integer

:include: doc/matchdata/begin.rdoc

Overloads:


1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
# File 're.c', line 1356

static VALUE
match_begin(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 Qnil;

    update_char_offset(match);
    return LONG2NUM(RMATCH_EXT(match)->char_offset[i].beg);
}