From 388109f60219eb38c1fcbf9cea660a6ea4ef1a03 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 3 Aug 2026 11:58:52 -0400 Subject: [PATCH] [DOC] Minor fixes for Regexp --- doc/_regexp.rdoc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/_regexp.rdoc b/doc/_regexp.rdoc index e1140cf3983..0fc4f32d73c 100644 --- a/doc/_regexp.rdoc +++ b/doc/_regexp.rdoc @@ -452,7 +452,7 @@ ex. (?<=a|bc) is OK. (?<=aaa(?:b|cd)) is not allowed. /ab\Kc/.match('abc') # => # /(?<=ab)c/.match('abc') # => # - These match same string and $& equals 'c', + These match the same string and $& equals 'c', while the matched position is different. As are the following two regexps: @@ -703,7 +703,7 @@ unless the entire subexpression must be abandoned and subsequently revisited. In this way _subexpression_ is treated as a non-divisible whole. Atomic grouping is typically used to optimise patterns -to prevent needless backtracking . +to prevent needless backtracking. Example (without atomic grouping): @@ -999,7 +999,7 @@ The POSIX bracket expressions: - /[[:print:]]/: Matches /[[:graph:]]/ or space character. -- /[[:punct:]]/: Matches any (Unicode punctuation character}[https://www.compart.com/en/unicode/category/Po]: +- /[[:punct:]]/: Matches any {Unicode punctuation character}[https://www.compart.com/en/unicode/category/Po]: Ruby also supports these (non-POSIX) bracket expressions: @@ -1020,8 +1020,7 @@ Ruby also supports these (non-POSIX) bracket expressions: A comment may be included in a regexp pattern using the (?#_comment_) construct, -where _comment_ is a substring that is to be ignored. -arbitrary text ignored by the regexp engine: +where _comment_ is arbitrary text ignored by the regexp engine: /foo(?#Ignore me)bar/.match('foobar') # => #