diff --git a/doc/regexp.rdoc b/doc/regexp.rdoc index f3844d5729..a7e2a0786e 100644 --- a/doc/regexp.rdoc +++ b/doc/regexp.rdoc @@ -550,12 +550,16 @@ characters, anchoring the match to a specific position. * (?pat) - Negative lookbehind assertion: ensures that the preceding characters do not match pat, but doesn't include those characters in the matched text -* \K - Uses an positive lookbehind of the content preceding - \K in the regexp. For example, the following two regexps are - almost equivalent: - /ab\Kc/ - /(?<=ab)c/ +* \K - Match reset: the matched content preceding + \K in the regexp is excluded from the result. For example, + the following two regexps are almost equivalent: + + /ab\Kc/ =~ "abc" #=> 0 + /(?<=ab)c/ =~ "abc" #=> 2 + + These match same string and $& equals "c", while the + matched position is different. As are the following two regexps: