Ruby: RMatch Struct Reference

Ruby 3.3.5p100 (2024-09-03 revision ef084cc8f4958c1b6e4ead99136631bef6d8ddba)

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.

## 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 96 of file rmatch.h.

## Field Documentation

## ◆ basic

struct RBasic RMatch::basic

Basic part, including flags and class.

Definition at line 99 of file rmatch.h.

## ◆ regexp

VALUE RMatch::regexp

The expression of this match.

Definition at line 109 of file rmatch.h.

## ◆ str

VALUE RMatch::str

The target string that the match was made against.

Definition at line 104 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:

- include/ruby/internal/core/rmatch.h