Ruby 4.1.0dev (2026-05-15 revision a8bcae043f931d9b79f1cb1fe2c021985d07b984)
Data Fields
RMatch Struct Reference

Regular expression execution context. More...

#include <rmatch.h>

Data Fields

struct RBasic basic
 Basic part, including flags and class.
 
VALUE str
 The target string that the match was made against.
 
VALUE regexp
 The expression of this match.
 
int char_offset_num_allocated
 Number of rmatch_offset that ::rmatch::char_offset holds.
 
struct rmatch_offsetchar_offset
 Capture group offsets, in C array.
 
int num_regs
 Number of capture-group registers.
 
int capa
 Capacity of as.embed, in OnigPosition slots.
 
union { 
 
   OnigPosition   embed [1] 
 
   struct re_registers   onig 
 
as 
 "Registers" of a match.
 

Detailed Description

Regular expression execution context.

When a regular expression "matches" to a string, it generates capture groups etc. This struct holds that info. Visible from Ruby as an instance of MatchData.

Note
There is no way for extension libraries to manually generate this struct except by actually exercising the match operation of a regular expression.

Definition at line 79 of file rmatch.h.

Field Documentation

◆ [union]

union { ... } RMatch::as

"Registers" of a match.

This is a quasi-opaque struct that holds execution result of a match. Roughly resembles $~.

◆ basic

struct RBasic RMatch::basic

Basic part, including flags and class.

Definition at line 82 of file rmatch.h.

◆ capa

int RMatch::capa

Capacity of as.embed, in OnigPosition slots.

Definition at line 104 of file rmatch.h.

◆ char_offset

struct rmatch_offset* RMatch::char_offset

Capture group offsets, in C array.

Definition at line 98 of file rmatch.h.

◆ char_offset_num_allocated

int RMatch::char_offset_num_allocated

Number of rmatch_offset that ::rmatch::char_offset holds.

Definition at line 95 of file rmatch.h.

◆ embed

OnigPosition RMatch::embed[1]

Definition at line 111 of file rmatch.h.

◆ num_regs

int RMatch::num_regs

Number of capture-group registers.

Definition at line 101 of file rmatch.h.

◆ onig

struct re_registers RMatch::onig

Definition at line 112 of file rmatch.h.

◆ regexp

VALUE RMatch::regexp

The expression of this match.

Definition at line 92 of file rmatch.h.

◆ str

VALUE RMatch::str

The target string that the match was made against.

Definition at line 87 of file rmatch.h.

Referenced by rb_reg_adjust_startpos(), rb_reg_onig_match(), and rb_reg_prepare_re().


The documentation for this struct was generated from the following file: