Skip to content

regexp: support capture groups in Regexp#===#6884

Open
0x1eef wants to merge 1 commit into
mruby:masterfrom
0x1eef:regexp===
Open

regexp: support capture groups in Regexp#===#6884
0x1eef wants to merge 1 commit into
mruby:masterfrom
0x1eef:regexp===

Conversation

@0x1eef

@0x1eef 0x1eef commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Please close if there is a better way to do this.
Thanks.

Fixes #6883

@0x1eef 0x1eef requested a review from matz as a code owner June 9, 2026 21:20

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the regexp_case_match function in regexp.c to use exec_match instead of mrb_re_exec, ensuring that global match variables (like $1) are correctly populated during case equality (===) operations. A corresponding test case has been added to verify this behavior. Feedback on the changes points out a minor syntax issue with a redundant double semicolon at the end of a return statement in regexp.c.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread mrbgems/mruby-regexp/src/regexp.c Outdated
int ncap = mrb_re_exec(mrb, pat, RSTRING_PTR(str), RSTRING_LEN(str), 0, NULL, 0);
return mrb_bool_value(ncap > 0);
md = exec_match(mrb, self, str, 0);
return mrb_bool_value(!mrb_nil_p(md));;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a redundant double semicolon at the end of the return statement.

  return mrb_bool_value(!mrb_nil_p(md));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regexp#=== does not capture groups

1 participant