ruby-changes:53055
From: aycabta <ko1@a...>
Date: Sun, 21 Oct 2018 15:42:59 +0900 (JST)
Subject: [ruby-changes:53055] aycabta:r65269 (trunk): Improve doc of Regexp about "ignore case" behavior [Misc #10836]
aycabta 2018-10-21 15:42:53 +0900 (Sun, 21 Oct 2018) New Revision: 65269 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65269 Log: Improve doc of Regexp about "ignore case" behavior [Misc #10836] * doc/regexp.rdoc: RDoc for "ignore case" behavior Modified files: trunk/doc/regexp.rdoc Index: doc/regexp.rdoc =================================================================== --- doc/regexp.rdoc (revision 65268) +++ doc/regexp.rdoc (revision 65269) @@ -541,10 +541,15 @@ options which control how the pattern ca https://github.com/ruby/ruby/blob/trunk/doc/regexp.rdoc#L541 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>: -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/