From fdbc8eed42c960443e7a24b8e8ff583d4408b68b Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 21 Oct 2018 06:42:53 +0000 Subject: [PATCH] Improve doc of Regexp about "ignore case" behavior [Misc #10836] * doc/regexp.rdoc: RDoc for "ignore case" behavior git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- doc/regexp.rdoc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/regexp.rdoc b/doc/regexp.rdoc index 06c730058d..9218a75b67 100644 --- a/doc/regexp.rdoc +++ b/doc/regexp.rdoc @@ -541,10 +541,15 @@ options which control how the pattern can match. subexpression level with the (?on-off) construct, which enables options on, and disables options off for the -expression enclosed by the parentheses. +expression enclosed by the parentheses: - /a(?i:b)c/.match('aBc') #=> # - /a(?i:b)c/.match('abc') #=> # + /a(?i:b)c/.match('aBc') #=> # + /a(?-i:b)c/i.match('ABC') #=> nil + +Additionally, these options can also be toggled for the remainder of the +pattern: + + /a(?i)bc/.match('abC') #=> # Options may also be used with Regexp.new: