matched()
public
Show source
/*
* Returns the last matched string.
*
* s = StringScanner.new('test string')
* s.match?(/\w+/) # -> 4
* s.matched # -> "test"
*/
static VALUE
strscan_matched(VALUE self)
{
struct strscanner *p;
GET_SCANNER(self, p);
if (! MATCHED_P(p)) return Qnil;
return extract_range(p, p->prev + p->regs.beg[0],
p->prev + p->regs.end[0]);
}