summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authorShugo Maeda <[email protected]>2024-06-12 11:35:53 +0900
committerShugo Maeda <[email protected]>2024-07-16 14:48:06 +0900
commite048a073a3cba04576b8f6a1673c283e4e20cd90 ()
treef8eb52ab8d61192f2afb29c815db8deeddc7d94b /re.c
parenta887b41875d00637064294be7059335599937f17 (diff)
Add MatchData#bytebegin and MatchData#byteend
These methods return the byte-based offset of the beginning or end of the specified match. [Feature #20576]
-rw-r--r--re.c50
1 files changed, 50 insertions, 0 deletions
@@ -1298,6 +1298,54 @@ match_byteoffset(VALUE match, VALUE n)
/*
* call-seq:
* begin(n) -> integer
* begin(name) -> integer
*
@@ -4842,6 +4890,8 @@ Init_Regexp(void)
rb_define_method(rb_cMatch, "length", match_size, 0);
rb_define_method(rb_cMatch, "offset", match_offset, 1);
rb_define_method(rb_cMatch, "byteoffset", match_byteoffset, 1);
rb_define_method(rb_cMatch, "begin", match_begin, 1);
rb_define_method(rb_cMatch, "end", match_end, 1);
rb_define_method(rb_cMatch, "match", match_nth, 1);