summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authoraycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-21 06:42:53 +0000
committeraycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-21 06:42:53 +0000
commitfdbc8eed42c960443e7a24b8e8ff583d4408b68b (patch)
treef545d3beb5cc879bd1fa51dc4d1b81143cbe8828 /doc
parenta87e4d92083f25f5ec813363d01331639a8f1c7a (diff)
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
Diffstat (limited to 'doc')
-rw-r--r--doc/regexp.rdoc11
1 files changed, 8 insertions, 3 deletions
diff --git a/doc/regexp.rdoc b/doc/regexp.rdoc
index 06c7300..9218a75 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
<tt>(?</tt><i>on</i><tt>-</tt><i>off</i><tt>)</tt> construct, which
enables options <i>on</i>, and disables options <i>off</i> for the
-expression enclosed by the parentheses.
+expression enclosed by the parentheses:
- /a(?i:b)c/.match('aBc') #=> #<MatchData "aBc">
- /a(?i:b)c/.match('abc') #=> #<MatchData "abc">
+ /a(?i:b)c/.match('aBc') #=> #<MatchData "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') #=> #<MatchData "abC">
Options may also be used with <tt>Regexp.new</tt>: